@sequent-org/moodboard 1.0.15 → 1.0.17

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.15",
3
+ "version": "1.0.17",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -27,7 +27,7 @@ export class KeyboardManager {
27
27
  this.eventBus.emit(Events.UI.PasteImage, {
28
28
  src: uploadResult.url,
29
29
  name: uploadResult.name,
30
- imageId: uploadResult.id
30
+ imageId: uploadResult.imageId || uploadResult.id
31
31
  });
32
32
  } else {
33
33
  // Fallback к старому способу
@@ -54,7 +54,7 @@ export class KeyboardManager {
54
54
  this.eventBus.emit(Events.UI.PasteImage, {
55
55
  src: uploadResult.url,
56
56
  name: uploadResult.name,
57
- imageId: uploadResult.id
57
+ imageId: uploadResult.imageId || uploadResult.id
58
58
  });
59
59
  } else {
60
60
  // Fallback к старому способу: конвертируем в DataURL
@@ -50,7 +50,8 @@ export class FileUploadService {
50
50
  }
51
51
 
52
52
  return {
53
- id: result.data.id,
53
+ id: result.data.fileId || result.data.id, // Используем fileId как основное поле, id для обратной совместимости
54
+ fileId: result.data.fileId || result.data.id, // Добавляем fileId для явного доступа
54
55
  url: result.data.url,
55
56
  size: result.data.size,
56
57
  mimeType: result.data.mime_type,
@@ -55,7 +55,8 @@ export class ImageUploadService {
55
55
  }
56
56
 
57
57
  return {
58
- id: result.data.id,
58
+ id: result.data.imageId || result.data.id, // Используем imageId как основное поле, id для обратной совместимости
59
+ imageId: result.data.imageId || result.data.id, // Добавляем imageId для явного доступа
59
60
  url: result.data.url,
60
61
  width: result.data.width,
61
62
  height: result.data.height,
@@ -372,7 +372,7 @@ export class ToolManager {
372
372
  // Пытаемся загрузить изображение на сервер
373
373
  if (this.core && this.core.imageUploadService) {
374
374
  const uploadResult = await this.core.imageUploadService.uploadImage(file, file.name || 'image');
375
- emitAt(uploadResult.url, uploadResult.name, uploadResult.id, index++);
375
+ emitAt(uploadResult.url, uploadResult.name, uploadResult.imageId || uploadResult.id, index++);
376
376
  } else {
377
377
  // Fallback к старому способу (base64)
378
378
  await new Promise((resolve) => {
@@ -233,7 +233,7 @@ export class PlacementTool extends BaseTool {
233
233
  width: targetW,
234
234
  height: targetH
235
235
  },
236
- imageId: uploadResult.id // Сохраняем ID изображения
236
+ imageId: uploadResult.imageId || uploadResult.id // Сохраняем ID изображения
237
237
  });
238
238
  } catch (error) {
239
239
  console.error('Ошибка загрузки изображения:', error);
@@ -274,7 +274,7 @@ export class PlacementTool extends BaseTool {
274
274
  width: props.width || 120,
275
275
  height: props.height || 140
276
276
  },
277
- fileId: uploadResult.id // Сохраняем ID файла
277
+ fileId: uploadResult.fileId || uploadResult.id // Сохраняем ID файла
278
278
  });
279
279
 
280
280
  // Возвращаемся к инструменту выделения после создания файла
@@ -465,7 +465,7 @@ export class PlacementTool extends BaseTool {
465
465
  width: props.width || 120,
466
466
  height: props.height || 140
467
467
  },
468
- fileId: uploadResult.id // Сохраняем ID файла
468
+ fileId: uploadResult.fileId || uploadResult.id // Сохраняем ID файла
469
469
  });
470
470
 
471
471
  } catch (uploadError) {
@@ -961,7 +961,7 @@ export class PlacementTool extends BaseTool {
961
961
  width: targetW,
962
962
  height: targetH
963
963
  },
964
- imageId: uploadResult.id // Сохраняем ID изображения
964
+ imageId: uploadResult.imageId || uploadResult.id // Сохраняем ID изображения
965
965
  });
966
966
 
967
967
  } catch (uploadError) {
@@ -525,23 +525,35 @@ export class SelectTool extends BaseTool {
525
525
 
526
526
  // Сначала ищем в контейнере ручек (приоритет)
527
527
  if (this.resizeHandles.container && 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];
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 (this.resizeHandles.container && 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
 
@@ -222,6 +222,7 @@ export class HtmlHandlesLayer {
222
222
  position: 'absolute', pointerEvents: 'auto', cursor,
223
223
  zIndex: 5, // Меньше чем у ручек (10)
224
224
  background: 'transparent' // невидимые области
225
+
225
226
  });
226
227
  e.addEventListener('mousedown', (evt) => this._onEdgeResizeDown(evt));
227
228
  box.appendChild(e);