@sequent-org/moodboard 1.0.12 → 1.0.14
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
|
@@ -346,6 +346,25 @@ export class MoodBoard {
|
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Безопасное уничтожение объекта с проверкой наличия метода destroy
|
|
351
|
+
* @param {Object} obj - объект для уничтожения
|
|
352
|
+
* @param {string} name - имя объекта для логирования
|
|
353
|
+
*/
|
|
354
|
+
_safeDestroy(obj, name) {
|
|
355
|
+
if (obj) {
|
|
356
|
+
try {
|
|
357
|
+
if (typeof obj.destroy === 'function') {
|
|
358
|
+
obj.destroy();
|
|
359
|
+
} else {
|
|
360
|
+
console.warn(`Объект ${name} не имеет метода destroy()`);
|
|
361
|
+
}
|
|
362
|
+
} catch (error) {
|
|
363
|
+
console.error(`Ошибка при уничтожении ${name}:`, error);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
349
368
|
/**
|
|
350
369
|
* Очистка ресурсов
|
|
351
370
|
*/
|
|
@@ -359,58 +378,44 @@ export class MoodBoard {
|
|
|
359
378
|
// Устанавливаем флаг уничтожения
|
|
360
379
|
this.destroyed = true;
|
|
361
380
|
|
|
362
|
-
// Уничтожаем UI компоненты
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
this.toolbar = null;
|
|
366
|
-
}
|
|
381
|
+
// Уничтожаем UI компоненты с безопасными проверками
|
|
382
|
+
this._safeDestroy(this.toolbar, 'toolbar');
|
|
383
|
+
this.toolbar = null;
|
|
367
384
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
this.saveStatus = null;
|
|
371
|
-
}
|
|
385
|
+
this._safeDestroy(this.saveStatus, 'saveStatus');
|
|
386
|
+
this.saveStatus = null;
|
|
372
387
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
this.textPropertiesPanel = null;
|
|
376
|
-
}
|
|
388
|
+
this._safeDestroy(this.textPropertiesPanel, 'textPropertiesPanel');
|
|
389
|
+
this.textPropertiesPanel = null;
|
|
377
390
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
this.framePropertiesPanel = null;
|
|
381
|
-
}
|
|
391
|
+
this._safeDestroy(this.framePropertiesPanel, 'framePropertiesPanel');
|
|
392
|
+
this.framePropertiesPanel = null;
|
|
382
393
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
this.notePropertiesPanel = null;
|
|
386
|
-
}
|
|
394
|
+
this._safeDestroy(this.notePropertiesPanel, 'notePropertiesPanel');
|
|
395
|
+
this.notePropertiesPanel = null;
|
|
387
396
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
this.alignmentGuides = null;
|
|
391
|
-
}
|
|
397
|
+
this._safeDestroy(this.alignmentGuides, 'alignmentGuides');
|
|
398
|
+
this.alignmentGuides = null;
|
|
392
399
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
this.commentPopover = null;
|
|
396
|
-
}
|
|
400
|
+
this._safeDestroy(this.commentPopover, 'commentPopover');
|
|
401
|
+
this.commentPopover = null;
|
|
397
402
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
403
|
+
this._safeDestroy(this.contextMenu, 'contextMenu');
|
|
404
|
+
this.contextMenu = null;
|
|
405
|
+
|
|
406
|
+
this._safeDestroy(this.zoombar, 'zoombar');
|
|
407
|
+
this.zoombar = null;
|
|
408
|
+
|
|
409
|
+
this._safeDestroy(this.mapbar, 'mapbar');
|
|
410
|
+
this.mapbar = null;
|
|
402
411
|
|
|
403
412
|
// Уничтожаем ядро
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
this.coreMoodboard = null;
|
|
407
|
-
}
|
|
413
|
+
this._safeDestroy(this.coreMoodboard, 'coreMoodboard');
|
|
414
|
+
this.coreMoodboard = null;
|
|
408
415
|
|
|
409
416
|
// Уничтожаем workspace
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
this.workspaceManager = null;
|
|
413
|
-
}
|
|
417
|
+
this._safeDestroy(this.workspaceManager, 'workspaceManager');
|
|
418
|
+
this.workspaceManager = null;
|
|
414
419
|
|
|
415
420
|
// Очищаем ссылки на менеджеры
|
|
416
421
|
this.dataManager = null;
|
|
@@ -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,7 +519,7 @@ 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
|
|
|
@@ -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) {
|
package/src/ui/ContextMenu.js
CHANGED
|
@@ -9,6 +9,9 @@ export class ContextMenu {
|
|
|
9
9
|
this.lastX = 0;
|
|
10
10
|
this.lastY = 0;
|
|
11
11
|
this.currentGridType = 'line';
|
|
12
|
+
|
|
13
|
+
// Флаг состояния объекта
|
|
14
|
+
this.destroyed = false;
|
|
12
15
|
|
|
13
16
|
this.createElement();
|
|
14
17
|
this.attachEvents();
|
|
@@ -335,6 +338,30 @@ export class ContextMenu {
|
|
|
335
338
|
// По умолчанию — пусто
|
|
336
339
|
this.element.innerHTML = '<div style="padding:8px 12px; color:#888;">(пусто)</div>';
|
|
337
340
|
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Уничтожение контекстного меню
|
|
344
|
+
*/
|
|
345
|
+
destroy() {
|
|
346
|
+
if (this.destroyed) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
this.destroyed = true;
|
|
351
|
+
|
|
352
|
+
// Скрываем меню
|
|
353
|
+
this.hide();
|
|
354
|
+
|
|
355
|
+
// Удаляем DOM элемент
|
|
356
|
+
if (this.element && this.element.parentNode) {
|
|
357
|
+
this.element.parentNode.removeChild(this.element);
|
|
358
|
+
this.element = null;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Очищаем ссылки
|
|
362
|
+
this.container = null;
|
|
363
|
+
this.eventBus = null;
|
|
364
|
+
}
|
|
338
365
|
}
|
|
339
366
|
|
|
340
367
|
|