@sequent-org/moodboard 1.2.90 → 1.2.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2037,6 +2037,12 @@ export class SelectTool extends BaseTool {
|
|
|
2037
2037
|
const correctedBaseLeftPx = baseLeftPx / zoomFactor;
|
|
2038
2038
|
const correctedBaseTopPx = baseTopPx / zoomFactor;
|
|
2039
2039
|
|
|
2040
|
+
console.log('🔍 Browser zoom detection:', {
|
|
2041
|
+
zoomFactor,
|
|
2042
|
+
basePos: { left: baseLeftPx, top: baseTopPx },
|
|
2043
|
+
correctedPos: { left: correctedBaseLeftPx, top: correctedBaseTopPx }
|
|
2044
|
+
});
|
|
2045
|
+
|
|
2040
2046
|
const leftPx = Math.round(correctedBaseLeftPx - padLeft);
|
|
2041
2047
|
const topPx = create
|
|
2042
2048
|
? Math.round(correctedBaseTopPx - padTop - (lineHeightPx / 2)) // по клику совмещаем центр строки с точкой клика
|
|
@@ -2814,14 +2820,34 @@ export class SelectTool extends BaseTool {
|
|
|
2814
2820
|
* Получение коэффициента масштабирования браузера
|
|
2815
2821
|
*/
|
|
2816
2822
|
_getBrowserZoomFactor() {
|
|
2817
|
-
//
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
+
// Более надежный способ определения масштаба браузера
|
|
2824
|
+
try {
|
|
2825
|
+
// Создаем тестовый элемент с фиксированными размерами
|
|
2826
|
+
const testEl = document.createElement('div');
|
|
2827
|
+
testEl.style.position = 'absolute';
|
|
2828
|
+
testEl.style.left = '-9999px';
|
|
2829
|
+
testEl.style.top = '-9999px';
|
|
2830
|
+
testEl.style.width = '100px';
|
|
2831
|
+
testEl.style.height = '100px';
|
|
2832
|
+
testEl.style.visibility = 'hidden';
|
|
2833
|
+
testEl.style.pointerEvents = 'none';
|
|
2834
|
+
|
|
2835
|
+
document.body.appendChild(testEl);
|
|
2836
|
+
|
|
2837
|
+
// Измеряем реальные размеры
|
|
2838
|
+
const rect = testEl.getBoundingClientRect();
|
|
2839
|
+
const zoomFactor = 100 / rect.width; // 100px / реальная ширина
|
|
2840
|
+
|
|
2841
|
+
document.body.removeChild(testEl);
|
|
2842
|
+
|
|
2843
|
+
// Проверяем разумность результата
|
|
2844
|
+
if (isFinite(zoomFactor) && zoomFactor > 0.1 && zoomFactor < 10) {
|
|
2845
|
+
return zoomFactor;
|
|
2846
|
+
}
|
|
2847
|
+
} catch (_) {}
|
|
2823
2848
|
|
|
2824
|
-
|
|
2849
|
+
// Fallback: без коррекции
|
|
2850
|
+
return 1.0;
|
|
2825
2851
|
}
|
|
2826
2852
|
|
|
2827
2853
|
}
|
package/src/ui/HtmlTextLayer.js
CHANGED
|
@@ -376,14 +376,34 @@ export class HtmlTextLayer {
|
|
|
376
376
|
* Получение коэффициента масштабирования браузера
|
|
377
377
|
*/
|
|
378
378
|
_getBrowserZoomFactor() {
|
|
379
|
-
//
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
379
|
+
// Более надежный способ определения масштаба браузера
|
|
380
|
+
try {
|
|
381
|
+
// Создаем тестовый элемент с фиксированными размерами
|
|
382
|
+
const testEl = document.createElement('div');
|
|
383
|
+
testEl.style.position = 'absolute';
|
|
384
|
+
testEl.style.left = '-9999px';
|
|
385
|
+
testEl.style.top = '-9999px';
|
|
386
|
+
testEl.style.width = '100px';
|
|
387
|
+
testEl.style.height = '100px';
|
|
388
|
+
testEl.style.visibility = 'hidden';
|
|
389
|
+
testEl.style.pointerEvents = 'none';
|
|
390
|
+
|
|
391
|
+
document.body.appendChild(testEl);
|
|
392
|
+
|
|
393
|
+
// Измеряем реальные размеры
|
|
394
|
+
const rect = testEl.getBoundingClientRect();
|
|
395
|
+
const zoomFactor = 100 / rect.width; // 100px / реальная ширина
|
|
396
|
+
|
|
397
|
+
document.body.removeChild(testEl);
|
|
398
|
+
|
|
399
|
+
// Проверяем разумность результата
|
|
400
|
+
if (isFinite(zoomFactor) && zoomFactor > 0.1 && zoomFactor < 10) {
|
|
401
|
+
return zoomFactor;
|
|
402
|
+
}
|
|
403
|
+
} catch (_) {}
|
|
385
404
|
|
|
386
|
-
|
|
405
|
+
// Fallback: без коррекции
|
|
406
|
+
return 1.0;
|
|
387
407
|
}
|
|
388
408
|
}
|
|
389
409
|
|