@sequent-org/moodboard 1.2.36 → 1.2.37

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.36",
3
+ "version": "1.2.37",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -1990,8 +1990,22 @@ export class SelectTool extends BaseTool {
1990
1990
  ];
1991
1991
  } else {
1992
1992
  // Для обычного текста используем стандартное позиционирование
1993
- wrapper.style.left = `${screenPos.x}px`;
1994
- wrapper.style.top = `${screenPos.y}px`;
1993
+ // Динамически компенсируем внутренние отступы textarea, чтобы каретка оказалась ровно в точке клика
1994
+ let padTop = 0;
1995
+ let padLeft = 0;
1996
+ try {
1997
+ if (typeof window !== 'undefined' && window.getComputedStyle) {
1998
+ const cs = window.getComputedStyle(textarea);
1999
+ const pt = parseFloat(cs.paddingTop);
2000
+ const pl = parseFloat(cs.paddingLeft);
2001
+ if (isFinite(pt)) padTop = pt;
2002
+ if (isFinite(pl)) padLeft = pl;
2003
+ }
2004
+ } catch (_) {}
2005
+ const leftPx = create ? Math.round(screenPos.x - padLeft) : Math.round(screenPos.x);
2006
+ const topPx = create ? Math.round(screenPos.y - padTop) : Math.round(screenPos.y);
2007
+ wrapper.style.left = `${leftPx}px`;
2008
+ wrapper.style.top = `${topPx}px`;
1995
2009
  }
1996
2010
  // Минимальные границы (зависят от текущего режима: новый объект или редактирование существующего)
1997
2011
  const worldLayerRef = this.textEditor.world || (this.app?.stage);