@sequent-org/moodboard 1.2.41 → 1.2.42
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
|
@@ -2015,6 +2015,9 @@ export class SelectTool extends BaseTool {
|
|
|
2015
2015
|
const topPx = create ? Math.round(screenPos.y - padTop - (lineHeightPx / 2)) : Math.round(screenPos.y);
|
|
2016
2016
|
wrapper.style.left = `${leftPx}px`;
|
|
2017
2017
|
wrapper.style.top = `${topPx}px`;
|
|
2018
|
+
// Сохраняем CSS-позицию редактора для точной синхронизации при закрытии
|
|
2019
|
+
this.textEditor._cssLeftPx = leftPx;
|
|
2020
|
+
this.textEditor._cssTopPx = topPx;
|
|
2018
2021
|
// Диагностика: логируем позицию инпута и вычисленные параметры позиционирования
|
|
2019
2022
|
try {
|
|
2020
2023
|
console.log('🧭 Text input', {
|
|
@@ -2592,6 +2595,29 @@ export class SelectTool extends BaseTool {
|
|
|
2592
2595
|
const el = window.moodboardHtmlTextLayer.idToEl.get(objectId);
|
|
2593
2596
|
if (el) {
|
|
2594
2597
|
this.eventBus.emit(Events.Tool.ShowObjectText, { objectId });
|
|
2598
|
+
// После отображения статичного текста — выровняем его позицию ровно под textarea
|
|
2599
|
+
try {
|
|
2600
|
+
const view = this.app?.view;
|
|
2601
|
+
const worldLayerRef = this.textEditor.world || (this.app?.stage);
|
|
2602
|
+
const viewRes = (this.app?.renderer?.resolution) || (view && view.width && view.clientWidth ? (view.width / view.clientWidth) : 1);
|
|
2603
|
+
const cssLeft = this.textEditor._cssLeftPx;
|
|
2604
|
+
const cssTop = this.textEditor._cssTopPx;
|
|
2605
|
+
if (isFinite(cssLeft) && isFinite(cssTop) && worldLayerRef) {
|
|
2606
|
+
// Ждем один тик, чтобы HtmlTextLayer успел обновить DOM
|
|
2607
|
+
setTimeout(() => {
|
|
2608
|
+
try {
|
|
2609
|
+
const desiredGlobal = new PIXI.Point(Math.round(cssLeft * viewRes), Math.round(cssTop * viewRes));
|
|
2610
|
+
const desiredWorld = worldLayerRef.toLocal(desiredGlobal);
|
|
2611
|
+
const newPos = { x: Math.round(desiredWorld.x), y: Math.round(desiredWorld.y) };
|
|
2612
|
+
this.eventBus.emit(Events.Object.StateChanged, {
|
|
2613
|
+
objectId,
|
|
2614
|
+
updates: { position: newPos }
|
|
2615
|
+
});
|
|
2616
|
+
console.log('🧭 Text post-show align', { objectId, cssLeft, cssTop, newPos });
|
|
2617
|
+
} catch (_) {}
|
|
2618
|
+
}, 0);
|
|
2619
|
+
}
|
|
2620
|
+
} catch (_) {}
|
|
2595
2621
|
} else {
|
|
2596
2622
|
console.warn(`❌ SelectTool: HTML-элемент для объекта ${objectId} не найден, пропускаем ShowObjectText`);
|
|
2597
2623
|
}
|