@sequent-org/moodboard 1.2.96 → 1.2.97

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.96",
3
+ "version": "1.2.97",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -2688,21 +2688,31 @@ 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);
2692
2691
  const cssLeft = this.textEditor._cssLeftPx;
2693
2692
  const cssTop = this.textEditor._cssTopPx;
2694
- if (isFinite(cssLeft) && isFinite(cssTop) && worldLayerRef) {
2693
+ if (isFinite(cssLeft) && isFinite(cssTop) && worldLayerRef && view && view.parentElement) {
2695
2694
  // Ждем один тик, чтобы HtmlTextLayer успел обновить DOM
2696
2695
  setTimeout(() => {
2697
2696
  try {
2698
- const desiredGlobal = new PIXI.Point(Math.round(cssLeft * viewRes), Math.round(cssTop * viewRes));
2699
- const desiredWorld = worldLayerRef.toLocal(desiredGlobal);
2697
+ // Используем тот же подход что в toScreen, но в обратном направлении
2698
+ const containerRect = view.parentElement.getBoundingClientRect();
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));
2700
2709
  const newPos = { x: Math.round(desiredWorld.x), y: Math.round(desiredWorld.y) };
2710
+
2701
2711
  this.eventBus.emit(Events.Object.StateChanged, {
2702
2712
  objectId,
2703
2713
  updates: { position: newPos }
2704
2714
  });
2705
- console.log('🧭 Text post-show align', { objectId, cssLeft, cssTop, newPos });
2715
+ console.log('🧭 Text post-show align', { objectId, cssLeft, cssTop, screenX, screenY, newPos });
2706
2716
  } catch (_) {}
2707
2717
  }, 0);
2708
2718
  }