@sequent-org/moodboard 1.2.97 → 1.2.98
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
|
@@ -2688,31 +2688,21 @@ export class SelectTool extends BaseTool {
|
|
|
2688
2688
|
try {
|
|
2689
2689
|
const view = this.app?.view;
|
|
2690
2690
|
const worldLayerRef = this.textEditor.world || (this.app?.stage);
|
|
2691
|
+
const viewRes = (this.app?.renderer?.resolution) || (view && view.width && view.clientWidth ? (view.width / view.clientWidth) : 1);
|
|
2691
2692
|
const cssLeft = this.textEditor._cssLeftPx;
|
|
2692
2693
|
const cssTop = this.textEditor._cssTopPx;
|
|
2693
|
-
if (isFinite(cssLeft) && isFinite(cssTop) && worldLayerRef
|
|
2694
|
+
if (isFinite(cssLeft) && isFinite(cssTop) && worldLayerRef) {
|
|
2694
2695
|
// Ждем один тик, чтобы HtmlTextLayer успел обновить DOM
|
|
2695
2696
|
setTimeout(() => {
|
|
2696
2697
|
try {
|
|
2697
|
-
|
|
2698
|
-
const
|
|
2699
|
-
const viewRect = view.getBoundingClientRect();
|
|
2700
|
-
const offsetLeft = viewRect.left - containerRect.left;
|
|
2701
|
-
const offsetTop = viewRect.top - containerRect.top;
|
|
2702
|
-
|
|
2703
|
-
// Преобразуем CSS координаты в экранные (учитывая offset)
|
|
2704
|
-
const screenX = cssLeft - offsetLeft;
|
|
2705
|
-
const screenY = cssTop - offsetTop;
|
|
2706
|
-
|
|
2707
|
-
// Преобразуем экранные координаты в мировые
|
|
2708
|
-
const desiredWorld = worldLayerRef.toLocal(new PIXI.Point(screenX, screenY));
|
|
2698
|
+
const desiredGlobal = new PIXI.Point(Math.round(cssLeft * viewRes), Math.round(cssTop * viewRes));
|
|
2699
|
+
const desiredWorld = worldLayerRef.toLocal(desiredGlobal);
|
|
2709
2700
|
const newPos = { x: Math.round(desiredWorld.x), y: Math.round(desiredWorld.y) };
|
|
2710
|
-
|
|
2711
2701
|
this.eventBus.emit(Events.Object.StateChanged, {
|
|
2712
2702
|
objectId,
|
|
2713
2703
|
updates: { position: newPos }
|
|
2714
2704
|
});
|
|
2715
|
-
console.log('🧭 Text post-show align', { objectId, cssLeft, cssTop,
|
|
2705
|
+
console.log('🧭 Text post-show align', { objectId, cssLeft, cssTop, newPos });
|
|
2716
2706
|
} catch (_) {}
|
|
2717
2707
|
}, 0);
|
|
2718
2708
|
}
|