@sequent-org/moodboard 1.2.64 → 1.2.66

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.64",
3
+ "version": "1.2.66",
4
4
  "type": "module",
5
5
  "description": "Interactive moodboard",
6
6
  "main": "./src/index.js",
@@ -232,11 +232,19 @@ export class MoodBoard {
232
232
  // Смена фона доски по выбору цвета в топбаре
233
233
  this.coreMoodboard.eventBus.on(Events.UI.PaintPick, ({ color }) => {
234
234
  if (!color) return;
235
- const hex = typeof color === 'string' && color.startsWith('#')
236
- ? parseInt(color.slice(1), 16)
237
- : color;
238
- if (this.coreMoodboard?.pixi?.app?.renderer) {
239
- this.coreMoodboard.pixi.app.renderer.backgroundColor = hex;
235
+ // Централизованное применение через SettingsApplier,
236
+ // чтобы гарантировать эмит события для автосохранения
237
+ if (this.settingsApplier && typeof this.settingsApplier.set === 'function') {
238
+ this.settingsApplier.set({ backgroundColor: color });
239
+ } else {
240
+ // Fallback на случай отсутствия аплаера (не должен случаться)
241
+ const hex = (typeof color === 'string' && color.startsWith('#'))
242
+ ? parseInt(color.slice(1), 16)
243
+ : color;
244
+ if (this.coreMoodboard?.pixi?.app?.renderer) {
245
+ this.coreMoodboard.pixi.app.renderer.backgroundColor = hex;
246
+ }
247
+ this.coreMoodboard.eventBus.emit(Events.Grid.BoardDataChanged, { settings: { backgroundColor: color } });
240
248
  }
241
249
  });
242
250
  }
@@ -16,6 +16,10 @@ export class SettingsApplier {
16
16
  set(partial) {
17
17
  this.settings = { ...this.settings, ...(partial || {}) };
18
18
  this.apply(this.settings);
19
+ // Сообщаем системе об изменении настроек для автосохранения
20
+ try {
21
+ this.eventBus && this.eventBus.emit(Events.Grid.BoardDataChanged, { settings: this.get() });
22
+ } catch (_) {}
19
23
  }
20
24
 
21
25
  get() {
@@ -34,7 +38,7 @@ export class SettingsApplier {
34
38
  if (this.ui.topbar) {
35
39
  try {
36
40
  const boardHex = this._toHex(bgInt);
37
- this.ui.topbar.setCurrentBoardHex(boardHex);
41
+ this.ui.topbar.setPaintButtonHex(this.ui.topbar.mapBoardToBtnHex(boardHex));
38
42
  } catch (_) {}
39
43
  }
40
44
  }