@sequent-org/moodboard 1.2.89 → 1.2.90
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
|
@@ -235,12 +235,7 @@ export class PlacementTool extends BaseTool {
|
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
|
|
239
|
-
const zoomFactor = this._getBrowserZoomFactor();
|
|
240
|
-
const correctedX = event.x * zoomFactor;
|
|
241
|
-
const correctedY = event.y * zoomFactor;
|
|
242
|
-
|
|
243
|
-
const worldPoint = this._toWorld(correctedX, correctedY);
|
|
238
|
+
const worldPoint = this._toWorld(event.x, event.y);
|
|
244
239
|
// Базовая позиция (может быть переопределена для конкретных типов)
|
|
245
240
|
let position = {
|
|
246
241
|
x: Math.round(worldPoint.x - (this.pending.size?.width ?? 100) / 2),
|
|
@@ -262,9 +257,7 @@ export class PlacementTool extends BaseTool {
|
|
|
262
257
|
try {
|
|
263
258
|
console.log('🧭 Text click', {
|
|
264
259
|
cursor: { x: event.x, y: event.y },
|
|
265
|
-
|
|
266
|
-
world: { x: Math.round(worldPoint.x), y: Math.round(worldPoint.y) },
|
|
267
|
-
zoomFactor: zoomFactor
|
|
260
|
+
world: { x: Math.round(worldPoint.x), y: Math.round(worldPoint.y) }
|
|
268
261
|
});
|
|
269
262
|
} catch (_) {}
|
|
270
263
|
position = {
|
|
@@ -538,19 +531,6 @@ export class PlacementTool extends BaseTool {
|
|
|
538
531
|
return world || this.app.stage;
|
|
539
532
|
}
|
|
540
533
|
|
|
541
|
-
/**
|
|
542
|
-
* Получение коэффициента масштабирования браузера
|
|
543
|
-
*/
|
|
544
|
-
_getBrowserZoomFactor() {
|
|
545
|
-
// Определяем масштаб браузера разными способами
|
|
546
|
-
const outerInnerRatio = window.outerWidth / window.innerWidth;
|
|
547
|
-
const devicePixelRatio = window.devicePixelRatio || 1;
|
|
548
|
-
|
|
549
|
-
// Используемый подход: соотношение размеров окна браузера
|
|
550
|
-
const zoomFactor = outerInnerRatio;
|
|
551
|
-
|
|
552
|
-
return Math.max(0.1, Math.min(5, zoomFactor)); // Ограничиваем разумными пределами
|
|
553
|
-
}
|
|
554
534
|
|
|
555
535
|
/**
|
|
556
536
|
* Обработчик движения мыши для обновления позиции "призрака"
|
|
@@ -1849,13 +1849,7 @@ export class SelectTool extends BaseTool {
|
|
|
1849
1849
|
if (!worldLayer) return { x: wx, y: wy };
|
|
1850
1850
|
const global = worldLayer.toGlobal(new PIXI.Point(wx, wy));
|
|
1851
1851
|
const viewRes = (this.app?.renderer?.resolution) || (view.width && view.clientWidth ? (view.width / view.clientWidth) : 1);
|
|
1852
|
-
|
|
1853
|
-
// Учитываем масштаб браузера при позиционировании HTML элементов
|
|
1854
|
-
const zoomFactor = this._getBrowserZoomFactor();
|
|
1855
|
-
return {
|
|
1856
|
-
x: (global.x / viewRes) / zoomFactor,
|
|
1857
|
-
y: (global.y / viewRes) / zoomFactor
|
|
1858
|
-
};
|
|
1852
|
+
return { x: global.x / viewRes, y: global.y / viewRes };
|
|
1859
1853
|
};
|
|
1860
1854
|
const screenPos = toScreen(position.x, position.y);
|
|
1861
1855
|
|
|
@@ -2038,10 +2032,15 @@ export class SelectTool extends BaseTool {
|
|
|
2038
2032
|
}
|
|
2039
2033
|
} catch (_) {}
|
|
2040
2034
|
|
|
2041
|
-
|
|
2035
|
+
// Учитываем масштаб браузера для позиционирования формы редактирования
|
|
2036
|
+
const zoomFactor = this._getBrowserZoomFactor();
|
|
2037
|
+
const correctedBaseLeftPx = baseLeftPx / zoomFactor;
|
|
2038
|
+
const correctedBaseTopPx = baseTopPx / zoomFactor;
|
|
2039
|
+
|
|
2040
|
+
const leftPx = Math.round(correctedBaseLeftPx - padLeft);
|
|
2042
2041
|
const topPx = create
|
|
2043
|
-
? Math.round(
|
|
2044
|
-
: Math.round(
|
|
2042
|
+
? Math.round(correctedBaseTopPx - padTop - (lineHeightPx / 2)) // по клику совмещаем центр строки с точкой клика
|
|
2043
|
+
: Math.round(correctedBaseTopPx - padTop); // при редактировании совмещаем верх контента
|
|
2045
2044
|
wrapper.style.left = `${leftPx}px`;
|
|
2046
2045
|
wrapper.style.top = `${topPx}px`;
|
|
2047
2046
|
// Сохраняем CSS-позицию редактора для точной синхронизации при закрытии
|