@sequent-org/moodboard 1.2.88 → 1.2.89

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequent-org/moodboard",
3
- "version": "1.2.88",
3
+ "version": "1.2.89",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -305,14 +305,15 @@ export class HtmlTextLayer {
305
305
  el.style.lineHeight = newLH;
306
306
  }
307
307
 
308
- // Позиция и габариты в экранных координатах
309
- const left = (tx + s * x) / res;
310
- const top = (ty + s * y) / res;
308
+ // Позиция и габариты в экранных координатах с учетом масштаба браузера
309
+ const zoomFactor = this._getBrowserZoomFactor();
310
+ const left = ((tx + s * x) / res) / zoomFactor;
311
+ const top = ((ty + s * y) / res) / zoomFactor;
311
312
  el.style.left = `${left}px`;
312
313
  el.style.top = `${top}px`;
313
314
  if (w && h) {
314
- el.style.width = `${Math.max(1, (w * s) / res)}px`;
315
- el.style.height = `${Math.max(1, (h * s) / res)}px`;
315
+ el.style.width = `${Math.max(1, ((w * s) / res) / zoomFactor)}px`;
316
+ el.style.height = `${Math.max(1, ((h * s) / res) / zoomFactor)}px`;
316
317
  }
317
318
  // Поворот вокруг центра (как у PIXI и HTML-ручек)
318
319
  el.style.transformOrigin = 'center center';
@@ -368,7 +369,21 @@ export class HtmlTextLayer {
368
369
  position
369
370
  });
370
371
  }
371
- } catch (_) {}
372
+ } catch (_) { }
373
+ }
374
+
375
+ /**
376
+ * Получение коэффициента масштабирования браузера
377
+ */
378
+ _getBrowserZoomFactor() {
379
+ // Определяем масштаб браузера разными способами
380
+ const outerInnerRatio = window.outerWidth / window.innerWidth;
381
+ const devicePixelRatio = window.devicePixelRatio || 1;
382
+
383
+ // Используемый подход: соотношение размеров окна браузера
384
+ const zoomFactor = outerInnerRatio;
385
+
386
+ return Math.max(0.1, Math.min(5, zoomFactor)); // Ограничиваем разумными пределами
372
387
  }
373
388
  }
374
389