@sequent-org/moodboard 1.2.36 → 1.2.38

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.38",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -253,6 +253,13 @@ export class PlacementTool extends BaseTool {
253
253
 
254
254
  if (isTextWithEditing) {
255
255
  // Для текста позиция должна совпадать с точкой клика без смещений
256
+ // Диагностика: логируем позицию курсора и мировые координаты в момент клика
257
+ try {
258
+ console.log('🧭 Text click', {
259
+ cursor: { x: event.x, y: event.y },
260
+ world: { x: Math.round(worldPoint.x), y: Math.round(worldPoint.y) }
261
+ });
262
+ } catch (_) {}
256
263
  position = {
257
264
  x: Math.round(worldPoint.x),
258
265
  y: Math.round(worldPoint.y)
@@ -1990,8 +1990,31 @@ 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`;
2009
+ // Диагностика: логируем позицию инпута и вычисленные параметры позиционирования
2010
+ try {
2011
+ console.log('🧭 Text input', {
2012
+ input: { left: leftPx, top: topPx },
2013
+ screenPos,
2014
+ padding: { top: padTop, left: padLeft },
2015
+ create
2016
+ });
2017
+ } catch (_) {}
1995
2018
  }
1996
2019
  // Минимальные границы (зависят от текущего режима: новый объект или редактирование существующего)
1997
2020
  const worldLayerRef = this.textEditor.world || (this.app?.stage);