@sequent-org/moodboard 1.2.102 → 1.2.103
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 +1 -1
- package/src/ui/HtmlTextLayer.js +9 -6
package/package.json
CHANGED
package/src/ui/HtmlTextLayer.js
CHANGED
|
@@ -325,12 +325,15 @@ export class HtmlTextLayer {
|
|
|
325
325
|
const tl = worldLayer.toGlobal(new PIXI.Point(x, y));
|
|
326
326
|
const br = worldLayer.toGlobal(new PIXI.Point(x + w, y + h));
|
|
327
327
|
|
|
328
|
-
// toGlobal() возвращает координаты в
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
const
|
|
328
|
+
// ВАЖНО: toGlobal() уже возвращает координаты в логических экранных пикселях
|
|
329
|
+
// (как и для HtmlHandlesLayer), поэтому делить их на renderer.resolution
|
|
330
|
+
// при вычислении CSS-позиции и размеров не нужно. Деление приводило к тому,
|
|
331
|
+
// что при res < 1 (масштаб браузера ≠ 100%) HTML-текст уезжал относительно
|
|
332
|
+
// собственных рамок и PIXI-объекта.
|
|
333
|
+
const left = offsetLeft + tl.x;
|
|
334
|
+
const top = offsetTop + tl.y;
|
|
335
|
+
const width = Math.max(1, (br.x - tl.x));
|
|
336
|
+
const height = Math.max(1, (br.y - tl.y));
|
|
334
337
|
|
|
335
338
|
// Применяем к элементу
|
|
336
339
|
el.style.left = `${left}px`;
|