@sequent-org/moodboard 1.2.95 → 1.2.96
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
|
@@ -1847,9 +1847,21 @@ export class SelectTool extends BaseTool {
|
|
|
1847
1847
|
const toScreen = (wx, wy) => {
|
|
1848
1848
|
const worldLayer = this.textEditor.world || (this.app?.stage);
|
|
1849
1849
|
if (!worldLayer) return { x: wx, y: wy };
|
|
1850
|
+
|
|
1851
|
+
// Используем тот же подход, что в HtmlHandlesLayer для рамки выделения
|
|
1852
|
+
const containerRect = view.parentElement.getBoundingClientRect();
|
|
1853
|
+
const viewRect = view.getBoundingClientRect();
|
|
1854
|
+
const offsetLeft = viewRect.left - containerRect.left;
|
|
1855
|
+
const offsetTop = viewRect.top - containerRect.top;
|
|
1856
|
+
|
|
1857
|
+
// Преобразуем мировые координаты в экранные через toGlobal
|
|
1850
1858
|
const global = worldLayer.toGlobal(new PIXI.Point(wx, wy));
|
|
1851
|
-
|
|
1852
|
-
|
|
1859
|
+
|
|
1860
|
+
// Возвращаем CSS координаты с учетом offset
|
|
1861
|
+
return {
|
|
1862
|
+
x: offsetLeft + global.x,
|
|
1863
|
+
y: offsetTop + global.y
|
|
1864
|
+
};
|
|
1853
1865
|
};
|
|
1854
1866
|
const screenPos = toScreen(position.x, position.y);
|
|
1855
1867
|
|
package/src/ui/HtmlTextLayer.js
CHANGED
|
@@ -305,14 +305,42 @@ export class HtmlTextLayer {
|
|
|
305
305
|
el.style.lineHeight = newLH;
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
// Позиция и габариты в
|
|
309
|
-
const
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
308
|
+
// Позиция и габариты в CSS координатах - используем тот же подход что в HtmlHandlesLayer
|
|
309
|
+
const worldLayer = this.core.pixi.worldLayer || this.core.pixi.app.stage;
|
|
310
|
+
const view = this.core.pixi.app.view;
|
|
311
|
+
|
|
312
|
+
if (worldLayer && view && view.parentElement) {
|
|
313
|
+
const containerRect = view.parentElement.getBoundingClientRect();
|
|
314
|
+
const viewRect = view.getBoundingClientRect();
|
|
315
|
+
const offsetLeft = viewRect.left - containerRect.left;
|
|
316
|
+
const offsetTop = viewRect.top - containerRect.top;
|
|
317
|
+
|
|
318
|
+
// Преобразуем мировые координаты в экранные через toGlobal
|
|
319
|
+
const tl = worldLayer.toGlobal(new PIXI.Point(x, y));
|
|
320
|
+
const br = worldLayer.toGlobal(new PIXI.Point(x + w, y + h));
|
|
321
|
+
|
|
322
|
+
// CSS координаты с учетом offset
|
|
323
|
+
const left = offsetLeft + tl.x;
|
|
324
|
+
const top = offsetTop + tl.y;
|
|
325
|
+
const width = Math.max(1, br.x - tl.x);
|
|
326
|
+
const height = Math.max(1, br.y - tl.y);
|
|
327
|
+
|
|
328
|
+
el.style.left = `${left}px`;
|
|
329
|
+
el.style.top = `${top}px`;
|
|
330
|
+
if (w && h) {
|
|
331
|
+
el.style.width = `${width}px`;
|
|
332
|
+
el.style.height = `${height}px`;
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
// Fallback к старому методу
|
|
336
|
+
const left = (tx + s * x) / res;
|
|
337
|
+
const top = (ty + s * y) / res;
|
|
338
|
+
el.style.left = `${left}px`;
|
|
339
|
+
el.style.top = `${top}px`;
|
|
340
|
+
if (w && h) {
|
|
341
|
+
el.style.width = `${Math.max(1, (w * s) / res)}px`;
|
|
342
|
+
el.style.height = `${Math.max(1, (h * s) / res)}px`;
|
|
343
|
+
}
|
|
316
344
|
}
|
|
317
345
|
// Поворот вокруг центра (как у PIXI и HTML-ручек)
|
|
318
346
|
el.style.transformOrigin = 'center center';
|