@sequent-org/moodboard 1.2.51 → 1.2.53

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.2.51",
3
+ "version": "1.2.53",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -223,6 +223,10 @@ export class MoodBoard {
223
223
  : color;
224
224
  if (this.coreMoodboard?.pixi?.app?.renderer) {
225
225
  this.coreMoodboard.pixi.app.renderer.backgroundColor = hex;
226
+ // Сигнализируем, что настройки доски изменились (для автосохранения)
227
+ try {
228
+ this.coreMoodboard.eventBus.emit(Events.Grid.BoardDataChanged, { settings: { backgroundColor: color } });
229
+ } catch (_) {}
226
230
  }
227
231
  });
228
232
  }
@@ -11,25 +11,9 @@ export class BoardService {
11
11
 
12
12
  async init(getCanvasSize) {
13
13
  this._getCanvasSize = getCanvasSize;
14
- // Инициализируем сетку (по умолчанию линейная)
15
- const canvasSize = (this._getCanvasSize?.() || {});
16
- this.grid = GridFactory.createGrid('line', {
17
- enabled: true,
18
- size: 32,
19
- width: canvasSize.width || 800,
20
- height: canvasSize.height || 600,
21
- color: 0x6a6aff,
22
- opacity: 0.4
23
- });
24
- this.grid.updateVisual();
25
- this.pixi.setGrid(this.grid);
26
- this.eventBus.emit(Events.UI.GridCurrent, { type: 'line' });
27
- // Сообщаем о текущих данных сетки для сохранения в boardData
28
- try {
29
- this.eventBus.emit(Events.Grid.BoardDataChanged, {
30
- grid: { type: 'line', options: this.grid.serialize ? this.grid.serialize() : {} }
31
- });
32
- } catch (_) {}
14
+ // Не создаём сетку по умолчанию, чтобы избежать визуального переключения.
15
+ // Сетка будет установлена из сохранённых настроек через Events.UI.GridChange.
16
+ this.grid = null;
33
17
 
34
18
  this._attachEvents();
35
19
  }
@@ -32,7 +32,12 @@ export class ZoomPanController {
32
32
  world.scale.set(newScale);
33
33
  world.x = x - worldX * newScale;
34
34
  world.y = y - worldY * newScale;
35
- this.eventBus.emit(Events.UI.ZoomPercent, { percentage: Math.round(newScale * 100) });
35
+ const pct = Math.round(newScale * 100);
36
+ this.eventBus.emit(Events.UI.ZoomPercent, { percentage: pct });
37
+ // Сигнализируем об изменении настроек (чтобы сохранить текущий зум)
38
+ try {
39
+ this.eventBus.emit(Events.Grid.BoardDataChanged, { settings: { zoom: { current: newScale, percentage: pct } } });
40
+ } catch (_) {}
36
41
  });
37
42
 
38
43
  // Кнопки зума из UI
package/src/ui/Topbar.js CHANGED
@@ -36,8 +36,6 @@ export class Topbar {
36
36
 
37
37
  this.createTopbar();
38
38
  this.attachEvents();
39
- // Активируем дефолтную кнопку (line) до прихода события из ядра
40
- this.setActive('line');
41
39
 
42
40
  // Синхронизация активного состояния по событию из ядра
43
41
  this.eventBus.on(Events.UI.GridCurrent, ({ type }) => {