@sequent-org/moodboard 1.2.79 → 1.2.80
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 +1 -1
- package/src/ui/HtmlHandlesLayer.js +11 -20
package/package.json
CHANGED
|
@@ -201,11 +201,7 @@ export class HtmlHandlesLayer {
|
|
|
201
201
|
if (!this.layer) return;
|
|
202
202
|
// Преобразуем world координаты в CSS-пиксели
|
|
203
203
|
const view = this.core.pixi.app.view;
|
|
204
|
-
|
|
205
|
-
// чтобы корректно работать при зуме браузера
|
|
206
|
-
const res = (view && view.width && view.clientWidth)
|
|
207
|
-
? (view.width / view.clientWidth)
|
|
208
|
-
: (this.core.pixi.app.renderer?.resolution || 1);
|
|
204
|
+
const res = (this.core.pixi.app.renderer?.resolution) || 1;
|
|
209
205
|
const containerRect = this.container.getBoundingClientRect();
|
|
210
206
|
const viewRect = view.getBoundingClientRect();
|
|
211
207
|
const offsetLeft = viewRect.left - containerRect.left;
|
|
@@ -228,11 +224,13 @@ export class HtmlHandlesLayer {
|
|
|
228
224
|
isFrameTarget = mbType === 'frame';
|
|
229
225
|
}
|
|
230
226
|
|
|
231
|
-
// Вычисляем позицию и размер
|
|
232
|
-
const
|
|
233
|
-
const
|
|
234
|
-
const
|
|
235
|
-
const
|
|
227
|
+
// Вычисляем позицию и размер через математику сцены (toGlobal) и переводим в CSS px
|
|
228
|
+
const tl = world.toGlobal(new PIXI.Point(worldBounds.x, worldBounds.y));
|
|
229
|
+
const br = world.toGlobal(new PIXI.Point(worldBounds.x + worldBounds.width, worldBounds.y + worldBounds.height));
|
|
230
|
+
const cssX = offsetLeft + (tl.x / res);
|
|
231
|
+
const cssY = offsetTop + (tl.y / res);
|
|
232
|
+
const cssWidth = Math.max(1, (br.x - tl.x) / res);
|
|
233
|
+
const cssHeight = Math.max(1, (br.y - tl.y) / res);
|
|
236
234
|
|
|
237
235
|
const left = Math.round(cssX);
|
|
238
236
|
const top = Math.round(cssY);
|
|
@@ -393,10 +391,7 @@ export class HtmlHandlesLayer {
|
|
|
393
391
|
_toWorldScreenInverse(dx, dy) {
|
|
394
392
|
const world = this.core.pixi.worldLayer || this.core.pixi.app.stage;
|
|
395
393
|
const s = world?.scale?.x || 1;
|
|
396
|
-
const
|
|
397
|
-
const res = (view && view.width && view.clientWidth)
|
|
398
|
-
? (view.width / view.clientWidth)
|
|
399
|
-
: (this.core.pixi.app.renderer?.resolution || 1);
|
|
394
|
+
const res = (this.core.pixi.app.renderer?.resolution) || 1;
|
|
400
395
|
return { dxWorld: (dx * res) / s, dyWorld: (dy * res) / s };
|
|
401
396
|
}
|
|
402
397
|
|
|
@@ -409,10 +404,8 @@ export class HtmlHandlesLayer {
|
|
|
409
404
|
const s = world?.scale?.x || 1;
|
|
410
405
|
const tx = world?.x || 0;
|
|
411
406
|
const ty = world?.y || 0;
|
|
407
|
+
const res = (this.core.pixi.app.renderer?.resolution) || 1;
|
|
412
408
|
const view = this.core.pixi.app.view;
|
|
413
|
-
const res = (view && view.width && view.clientWidth)
|
|
414
|
-
? (view.width / view.clientWidth)
|
|
415
|
-
: (this.core.pixi.app.renderer?.resolution || 1);
|
|
416
409
|
const containerRect = this.container.getBoundingClientRect();
|
|
417
410
|
const viewRect = view.getBoundingClientRect();
|
|
418
411
|
const offsetLeft = viewRect.left - containerRect.left;
|
|
@@ -688,10 +681,8 @@ export class HtmlHandlesLayer {
|
|
|
688
681
|
const s = world?.scale?.x || 1;
|
|
689
682
|
const tx = world?.x || 0;
|
|
690
683
|
const ty = world?.y || 0;
|
|
684
|
+
const res = (this.core.pixi.app.renderer?.resolution) || 1;
|
|
691
685
|
const view = this.core.pixi.app.view;
|
|
692
|
-
const res = (view && view.width && view.clientWidth)
|
|
693
|
-
? (view.width / view.clientWidth)
|
|
694
|
-
: (this.core.pixi.app.renderer?.resolution || 1);
|
|
695
686
|
const containerRect = this.container.getBoundingClientRect();
|
|
696
687
|
const viewRect = view.getBoundingClientRect();
|
|
697
688
|
const offsetLeft = viewRect.left - containerRect.left;
|