@sequent-org/moodboard 1.2.104 → 1.2.105
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
|
@@ -252,17 +252,35 @@ export class PlacementTool extends BaseTool {
|
|
|
252
252
|
};
|
|
253
253
|
|
|
254
254
|
if (isTextWithEditing) {
|
|
255
|
-
// Для текста позиция должна совпадать с точкой клика без
|
|
256
|
-
//
|
|
255
|
+
// Для текста позиция должна совпадать с точкой клика без смещений.
|
|
256
|
+
// Используем ту же систему координат, что HtmlTextLayer/HtmlHandlesLayer:
|
|
257
|
+
// CSS ←→ world через toGlobal/toLocal БЕЗ дополнительных поправок на resolution.
|
|
258
|
+
let worldForText = worldPoint;
|
|
257
259
|
try {
|
|
260
|
+
const app = this.app;
|
|
261
|
+
const view = app?.view;
|
|
262
|
+
const worldLayer = this.world || this._getWorldLayer();
|
|
263
|
+
if (view && view.parentElement && worldLayer && worldLayer.toLocal) {
|
|
264
|
+
const containerRect = view.parentElement.getBoundingClientRect();
|
|
265
|
+
const viewRect = view.getBoundingClientRect();
|
|
266
|
+
const offsetLeft = viewRect.left - containerRect.left;
|
|
267
|
+
const offsetTop = viewRect.top - containerRect.top;
|
|
268
|
+
// event.x / event.y заданы в координатах контейнера ToolManager,
|
|
269
|
+
// поэтому приводим их к экранным координатам относительно view
|
|
270
|
+
const screenX = event.x - offsetLeft;
|
|
271
|
+
const screenY = event.y - offsetTop;
|
|
272
|
+
const globalPoint = new PIXI.Point(screenX, screenY);
|
|
273
|
+
const local = worldLayer.toLocal(globalPoint);
|
|
274
|
+
worldForText = { x: local.x, y: local.y };
|
|
275
|
+
}
|
|
258
276
|
console.log('🧭 Text click', {
|
|
259
277
|
cursor: { x: event.x, y: event.y },
|
|
260
|
-
world: { x: Math.round(
|
|
278
|
+
world: { x: Math.round(worldForText.x), y: Math.round(worldForText.y) }
|
|
261
279
|
});
|
|
262
280
|
} catch (_) {}
|
|
263
281
|
position = {
|
|
264
|
-
x: Math.round(
|
|
265
|
-
y: Math.round(
|
|
282
|
+
x: Math.round(worldForText.x),
|
|
283
|
+
y: Math.round(worldForText.y)
|
|
266
284
|
};
|
|
267
285
|
// Слушаем событие создания объекта, чтобы получить его ID
|
|
268
286
|
const handleObjectCreated = (objectData) => {
|