@sequent-org/moodboard 1.2.91 → 1.2.92
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
|
@@ -2820,9 +2820,29 @@ export class SelectTool extends BaseTool {
|
|
|
2820
2820
|
* Получение коэффициента масштабирования браузера
|
|
2821
2821
|
*/
|
|
2822
2822
|
_getBrowserZoomFactor() {
|
|
2823
|
-
//
|
|
2823
|
+
// Множественные методы определения масштаба браузера для надежности
|
|
2824
|
+
let zoomFactors = [];
|
|
2825
|
+
|
|
2826
|
+
try {
|
|
2827
|
+
// Метод 1: Через window размеры
|
|
2828
|
+
const outerInnerRatio = window.outerWidth / window.innerWidth;
|
|
2829
|
+
if (isFinite(outerInnerRatio) && outerInnerRatio > 0.1 && outerInnerRatio < 10) {
|
|
2830
|
+
zoomFactors.push({ method: 'outerInner', value: outerInnerRatio });
|
|
2831
|
+
}
|
|
2832
|
+
} catch (_) {}
|
|
2833
|
+
|
|
2824
2834
|
try {
|
|
2825
|
-
//
|
|
2835
|
+
// Метод 2: Через visualViewport если доступно
|
|
2836
|
+
if (window.visualViewport) {
|
|
2837
|
+
const vpZoom = window.innerWidth / window.visualViewport.width;
|
|
2838
|
+
if (isFinite(vpZoom) && vpZoom > 0.1 && vpZoom < 10) {
|
|
2839
|
+
zoomFactors.push({ method: 'visualViewport', value: vpZoom });
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
} catch (_) {}
|
|
2843
|
+
|
|
2844
|
+
try {
|
|
2845
|
+
// Метод 3: Через тестовый элемент (проверяем разные единицы)
|
|
2826
2846
|
const testEl = document.createElement('div');
|
|
2827
2847
|
testEl.style.position = 'absolute';
|
|
2828
2848
|
testEl.style.left = '-9999px';
|
|
@@ -2834,20 +2854,38 @@ export class SelectTool extends BaseTool {
|
|
|
2834
2854
|
|
|
2835
2855
|
document.body.appendChild(testEl);
|
|
2836
2856
|
|
|
2837
|
-
// Измеряем реальные размеры
|
|
2838
2857
|
const rect = testEl.getBoundingClientRect();
|
|
2839
|
-
const
|
|
2858
|
+
const elemZoom = 100 / rect.width;
|
|
2840
2859
|
|
|
2841
2860
|
document.body.removeChild(testEl);
|
|
2842
2861
|
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
return zoomFactor;
|
|
2862
|
+
if (isFinite(elemZoom) && elemZoom > 0.1 && elemZoom < 10) {
|
|
2863
|
+
zoomFactors.push({ method: 'testElement', value: elemZoom });
|
|
2846
2864
|
}
|
|
2847
2865
|
} catch (_) {}
|
|
2848
2866
|
|
|
2849
|
-
//
|
|
2850
|
-
|
|
2867
|
+
// Логирование всех методов для диагностики
|
|
2868
|
+
console.log('🔍 Zoom detection methods:', zoomFactors);
|
|
2869
|
+
|
|
2870
|
+
// Выбираем наиболее подходящий результат
|
|
2871
|
+
if (zoomFactors.length === 0) {
|
|
2872
|
+
return 1.0; // Fallback
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
// Если есть visualViewport, предпочитаем его
|
|
2876
|
+
const vpMethod = zoomFactors.find(f => f.method === 'visualViewport');
|
|
2877
|
+
if (vpMethod) {
|
|
2878
|
+
return vpMethod.value;
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
// Иначе берем outerInner как наиболее стабильный
|
|
2882
|
+
const outerMethod = zoomFactors.find(f => f.method === 'outerInner');
|
|
2883
|
+
if (outerMethod) {
|
|
2884
|
+
return outerMethod.value;
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
// Последний fallback - первый доступный метод
|
|
2888
|
+
return zoomFactors[0].value;
|
|
2851
2889
|
}
|
|
2852
2890
|
|
|
2853
2891
|
}
|
package/src/ui/HtmlTextLayer.js
CHANGED
|
@@ -376,9 +376,29 @@ export class HtmlTextLayer {
|
|
|
376
376
|
* Получение коэффициента масштабирования браузера
|
|
377
377
|
*/
|
|
378
378
|
_getBrowserZoomFactor() {
|
|
379
|
-
//
|
|
379
|
+
// Множественные методы определения масштаба браузера для надежности
|
|
380
|
+
let zoomFactors = [];
|
|
381
|
+
|
|
382
|
+
try {
|
|
383
|
+
// Метод 1: Через window размеры
|
|
384
|
+
const outerInnerRatio = window.outerWidth / window.innerWidth;
|
|
385
|
+
if (isFinite(outerInnerRatio) && outerInnerRatio > 0.1 && outerInnerRatio < 10) {
|
|
386
|
+
zoomFactors.push({ method: 'outerInner', value: outerInnerRatio });
|
|
387
|
+
}
|
|
388
|
+
} catch (_) {}
|
|
389
|
+
|
|
390
|
+
try {
|
|
391
|
+
// Метод 2: Через visualViewport если доступно
|
|
392
|
+
if (window.visualViewport) {
|
|
393
|
+
const vpZoom = window.innerWidth / window.visualViewport.width;
|
|
394
|
+
if (isFinite(vpZoom) && vpZoom > 0.1 && vpZoom < 10) {
|
|
395
|
+
zoomFactors.push({ method: 'visualViewport', value: vpZoom });
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
} catch (_) {}
|
|
399
|
+
|
|
380
400
|
try {
|
|
381
|
-
//
|
|
401
|
+
// Метод 3: Через тестовый элемент (проверяем разные единицы)
|
|
382
402
|
const testEl = document.createElement('div');
|
|
383
403
|
testEl.style.position = 'absolute';
|
|
384
404
|
testEl.style.left = '-9999px';
|
|
@@ -390,20 +410,35 @@ export class HtmlTextLayer {
|
|
|
390
410
|
|
|
391
411
|
document.body.appendChild(testEl);
|
|
392
412
|
|
|
393
|
-
// Измеряем реальные размеры
|
|
394
413
|
const rect = testEl.getBoundingClientRect();
|
|
395
|
-
const
|
|
414
|
+
const elemZoom = 100 / rect.width;
|
|
396
415
|
|
|
397
416
|
document.body.removeChild(testEl);
|
|
398
417
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
return zoomFactor;
|
|
418
|
+
if (isFinite(elemZoom) && elemZoom > 0.1 && elemZoom < 10) {
|
|
419
|
+
zoomFactors.push({ method: 'testElement', value: elemZoom });
|
|
402
420
|
}
|
|
403
421
|
} catch (_) {}
|
|
404
422
|
|
|
405
|
-
//
|
|
406
|
-
|
|
423
|
+
// Выбираем наиболее подходящий результат
|
|
424
|
+
if (zoomFactors.length === 0) {
|
|
425
|
+
return 1.0; // Fallback
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// Если есть visualViewport, предпочитаем его
|
|
429
|
+
const vpMethod = zoomFactors.find(f => f.method === 'visualViewport');
|
|
430
|
+
if (vpMethod) {
|
|
431
|
+
return vpMethod.value;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Иначе берем outerInner как наиболее стабильный
|
|
435
|
+
const outerMethod = zoomFactors.find(f => f.method === 'outerInner');
|
|
436
|
+
if (outerMethod) {
|
|
437
|
+
return outerMethod.value;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Последний fallback - первый доступный метод
|
|
441
|
+
return zoomFactors[0].value;
|
|
407
442
|
}
|
|
408
443
|
}
|
|
409
444
|
|