@sequent-org/moodboard 1.2.37 → 1.2.39
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
|
@@ -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)
|
|
@@ -1993,19 +1993,39 @@ export class SelectTool extends BaseTool {
|
|
|
1993
1993
|
// Динамически компенсируем внутренние отступы textarea, чтобы каретка оказалась ровно в точке клика
|
|
1994
1994
|
let padTop = 0;
|
|
1995
1995
|
let padLeft = 0;
|
|
1996
|
+
let lineHeightPx = 0;
|
|
1996
1997
|
try {
|
|
1997
1998
|
if (typeof window !== 'undefined' && window.getComputedStyle) {
|
|
1998
1999
|
const cs = window.getComputedStyle(textarea);
|
|
1999
2000
|
const pt = parseFloat(cs.paddingTop);
|
|
2000
2001
|
const pl = parseFloat(cs.paddingLeft);
|
|
2002
|
+
const lh = parseFloat(cs.lineHeight);
|
|
2001
2003
|
if (isFinite(pt)) padTop = pt;
|
|
2002
2004
|
if (isFinite(pl)) padLeft = pl;
|
|
2005
|
+
if (isFinite(lh)) lineHeightPx = lh;
|
|
2003
2006
|
}
|
|
2004
2007
|
} catch (_) {}
|
|
2008
|
+
if (!isFinite(lineHeightPx) || lineHeightPx <= 0) {
|
|
2009
|
+
try {
|
|
2010
|
+
const r = textarea.getBoundingClientRect && textarea.getBoundingClientRect();
|
|
2011
|
+
if (r && isFinite(r.height)) lineHeightPx = r.height;
|
|
2012
|
+
} catch (_) {}
|
|
2013
|
+
}
|
|
2005
2014
|
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);
|
|
2015
|
+
const topPx = create ? Math.round(screenPos.y - padTop - (lineHeightPx / 2)) : Math.round(screenPos.y);
|
|
2007
2016
|
wrapper.style.left = `${leftPx}px`;
|
|
2008
2017
|
wrapper.style.top = `${topPx}px`;
|
|
2018
|
+
// Диагностика: логируем позицию инпута и вычисленные параметры позиционирования
|
|
2019
|
+
try {
|
|
2020
|
+
console.log('🧭 Text input', {
|
|
2021
|
+
input: { left: leftPx, top: topPx },
|
|
2022
|
+
screenPos,
|
|
2023
|
+
padding: { top: padTop, left: padLeft },
|
|
2024
|
+
lineHeightPx,
|
|
2025
|
+
caretCenterY: create ? (topPx + padTop + (lineHeightPx / 2)) : topPx,
|
|
2026
|
+
create
|
|
2027
|
+
});
|
|
2028
|
+
} catch (_) {}
|
|
2009
2029
|
}
|
|
2010
2030
|
// Минимальные границы (зависят от текущего режима: новый объект или редактирование существующего)
|
|
2011
2031
|
const worldLayerRef = this.textEditor.world || (this.app?.stage);
|