@sequent-org/moodboard 1.0.14 → 1.0.16

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.14",
3
+ "version": "1.0.16",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -524,24 +524,36 @@ export class SelectTool extends BaseTool {
524
524
  const point = new PIXI.Point(x, y);
525
525
 
526
526
  // Сначала ищем в контейнере ручек (приоритет)
527
- if (this.resizeHandles.container.visible) {
528
- for (let i = this.resizeHandles.container.children.length - 1; i >= 0; i--) {
529
- const child = this.resizeHandles.container.children[i];
527
+ if (this.resizeHandles.container && this.resizeHandles.container.visible) {
528
+ const container = this.resizeHandles.container;
529
+ if (!container || !container.children) return null;
530
+
531
+ for (let i = container.children.length - 1; i >= 0; i--) {
532
+ const child = container.children[i];
530
533
 
531
534
  // Проверяем обычные объекты
532
- if (child.containsPoint && child.containsPoint(point)) {
533
-
534
- return child;
535
+ if (child && child.containsPoint && typeof child.containsPoint === 'function') {
536
+ try {
537
+ if (child.containsPoint(point)) {
538
+ return child;
539
+ }
540
+ } catch (error) {
541
+ // Игнорируем ошибки containsPoint
542
+ }
535
543
  }
536
544
 
537
545
  // Специальная проверка для контейнеров (ручка вращения)
538
- if (child instanceof PIXI.Container && child.children.length > 0) {
546
+ if (child instanceof PIXI.Container && child.children && child.children.length > 0) {
539
547
  // Проверяем границы контейнера
540
- const bounds = child.getBounds();
541
- if (point.x >= bounds.x && point.x <= bounds.x + bounds.width &&
542
- point.y >= bounds.y && point.y <= bounds.y + bounds.height) {
548
+ try {
549
+ const bounds = child.getBounds();
550
+ if (bounds && point.x >= bounds.x && point.x <= bounds.x + bounds.width &&
551
+ point.y >= bounds.y && point.y <= bounds.y + bounds.height) {
543
552
 
544
- return child;
553
+ return child;
554
+ }
555
+ } catch (error) {
556
+ // Игнорируем ошибки getBounds
545
557
  }
546
558
  }
547
559
  }
@@ -549,11 +561,19 @@ export class SelectTool extends BaseTool {
549
561
 
550
562
  // Затем ищем в основной сцене
551
563
  const stage = this.resizeHandles.app.stage;
564
+ if (!stage || !stage.children) return null;
565
+
552
566
  for (let i = stage.children.length - 1; i >= 0; i--) {
553
567
  const child = stage.children[i];
554
- if (child !== this.resizeHandles.container && child.containsPoint && child.containsPoint(point)) {
555
-
556
- return child;
568
+ if (this.resizeHandles.container && child && child !== this.resizeHandles.container &&
569
+ child.containsPoint && typeof child.containsPoint === 'function') {
570
+ try {
571
+ if (child.containsPoint(point)) {
572
+ return child;
573
+ }
574
+ } catch (error) {
575
+ // Игнорируем ошибки containsPoint
576
+ }
557
577
  }
558
578
  }
559
579
 
@@ -1164,6 +1184,11 @@ export class SelectTool extends BaseTool {
1164
1184
  }
1165
1185
 
1166
1186
  clearSelection() {
1187
+ // Проверяем, что инструмент не уничтожен
1188
+ if (this.destroyed) {
1189
+ return;
1190
+ }
1191
+
1167
1192
  const objects = this.selection.toArray();
1168
1193
  this.selection.clear();
1169
1194
  this.emit(Events.Tool.SelectionClear, { objects });
@@ -1213,6 +1238,11 @@ export class SelectTool extends BaseTool {
1213
1238
  * Обновление ручек изменения размера
1214
1239
  */
1215
1240
  updateResizeHandles() {
1241
+ // Проверяем, что инструмент не уничтожен
1242
+ if (this.destroyed) {
1243
+ return;
1244
+ }
1245
+
1216
1246
  // Используем HTML-ручки (HtmlHandlesLayer). Прячем Pixi-ручки и групповые графики.
1217
1247
  try {
1218
1248
  if (this.resizeHandles && typeof this.resizeHandles.hideHandles === 'function') {