@sequent-org/moodboard 1.0.13 → 1.0.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sequent-org/moodboard",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -308,6 +308,11 @@ export class SelectTool extends BaseTool {
308
308
  * Перемещение мыши
309
309
  */
310
310
  onMouseMove(event) {
311
+ // Проверяем, что инструмент не уничтожен
312
+ if (this.destroyed) {
313
+ return;
314
+ }
315
+
311
316
  super.onMouseMove(event);
312
317
 
313
318
  // Обновляем текущие координаты мыши
@@ -468,6 +473,11 @@ export class SelectTool extends BaseTool {
468
473
  * Тестирование попадания курсора
469
474
  */
470
475
  hitTest(x, y) {
476
+ // Проверяем, что инструмент не уничтожен
477
+ if (this.destroyed) {
478
+ return { type: 'empty' };
479
+ }
480
+
471
481
  // Сначала проверяем ручки изменения размера (они имеют приоритет)
472
482
  if (this.resizeHandles) {
473
483
  const pixiObjectAtPoint = this.getPixiObjectAt(x, y);
@@ -509,12 +519,12 @@ export class SelectTool extends BaseTool {
509
519
  return null;
510
520
  }
511
521
 
512
- if (!this.resizeHandles || !this.resizeHandles.app) return null;
522
+ if (!this.resizeHandles || !this.resizeHandles.app || !this.resizeHandles.container) return null;
513
523
 
514
524
  const point = new PIXI.Point(x, y);
515
525
 
516
526
  // Сначала ищем в контейнере ручек (приоритет)
517
- if (this.resizeHandles.container.visible) {
527
+ if (this.resizeHandles.container && this.resizeHandles.container.visible) {
518
528
  for (let i = this.resizeHandles.container.children.length - 1; i >= 0; i--) {
519
529
  const child = this.resizeHandles.container.children[i];
520
530
 
@@ -541,7 +551,7 @@ export class SelectTool extends BaseTool {
541
551
  const stage = this.resizeHandles.app.stage;
542
552
  for (let i = stage.children.length - 1; i >= 0; i--) {
543
553
  const child = stage.children[i];
544
- if (child !== this.resizeHandles.container && child.containsPoint && child.containsPoint(point)) {
554
+ if (this.resizeHandles.container && child !== this.resizeHandles.container && child.containsPoint && child.containsPoint(point)) {
545
555
 
546
556
  return child;
547
557
  }
@@ -1051,6 +1061,11 @@ export class SelectTool extends BaseTool {
1051
1061
  * Обновление курсора
1052
1062
  */
1053
1063
  updateCursor(event) {
1064
+ // Проверяем, что инструмент не уничтожен
1065
+ if (this.destroyed) {
1066
+ return;
1067
+ }
1068
+
1054
1069
  const hitResult = this.hitTest(event.x, event.y);
1055
1070
 
1056
1071
  switch (hitResult.type) {
@@ -1149,6 +1164,11 @@ export class SelectTool extends BaseTool {
1149
1164
  }
1150
1165
 
1151
1166
  clearSelection() {
1167
+ // Проверяем, что инструмент не уничтожен
1168
+ if (this.destroyed) {
1169
+ return;
1170
+ }
1171
+
1152
1172
  const objects = this.selection.toArray();
1153
1173
  this.selection.clear();
1154
1174
  this.emit(Events.Tool.SelectionClear, { objects });
@@ -1198,6 +1218,11 @@ export class SelectTool extends BaseTool {
1198
1218
  * Обновление ручек изменения размера
1199
1219
  */
1200
1220
  updateResizeHandles() {
1221
+ // Проверяем, что инструмент не уничтожен
1222
+ if (this.destroyed) {
1223
+ return;
1224
+ }
1225
+
1201
1226
  // Используем HTML-ручки (HtmlHandlesLayer). Прячем Pixi-ручки и групповые графики.
1202
1227
  try {
1203
1228
  if (this.resizeHandles && typeof this.resizeHandles.hideHandles === 'function') {