@sequent-org/moodboard 1.2.52 → 1.2.54
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
|
@@ -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
|
}
|
|
@@ -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
|
-
|
|
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 }) => {
|
|
@@ -279,11 +277,21 @@ export class Topbar {
|
|
|
279
277
|
});
|
|
280
278
|
pop.appendChild(grid);
|
|
281
279
|
|
|
282
|
-
// Выделяем активный цвет галочкой
|
|
280
|
+
// Выделяем активный цвет галочкой (надежно — по data-hex)
|
|
283
281
|
try {
|
|
282
|
+
// 1) Пытаемся получить текущий цвет фона канваса
|
|
284
283
|
const boardHex = this._getCurrentBoardBackgroundHex();
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
// 2) Маппим к hex кнопки палитры
|
|
285
|
+
let targetHex = this.mapBoardToBtnHex(boardHex || '') || '';
|
|
286
|
+
// 3) Если не удалось — пробуем взять цвет с кнопки (custom prop)
|
|
287
|
+
if (!targetHex && this._paintBtn) {
|
|
288
|
+
const prop = getComputedStyle(this._paintBtn).getPropertyValue('--paint-btn-color') || '';
|
|
289
|
+
targetHex = prop.trim();
|
|
290
|
+
}
|
|
291
|
+
// 4) Фолбэк — первый цвет из палитры
|
|
292
|
+
if (!targetHex) targetHex = '#B3E5FC';
|
|
293
|
+
const normalized = String(targetHex).trim().toLowerCase();
|
|
294
|
+
const match = grid.querySelector(`[data-hex="${normalized}"]`);
|
|
287
295
|
if (match) match.classList.add('is-active');
|
|
288
296
|
} catch (_) {}
|
|
289
297
|
|
|
@@ -293,16 +301,7 @@ export class Topbar {
|
|
|
293
301
|
pop.style.left = `${rect.left - this.element.getBoundingClientRect().left}px`;
|
|
294
302
|
pop.style.top = `${rect.bottom - this.element.getBoundingClientRect().top + 6}px`;
|
|
295
303
|
|
|
296
|
-
//
|
|
297
|
-
try {
|
|
298
|
-
const currentBtnHex = (this._paintBtn && getComputedStyle(this._paintBtn).getPropertyValue('--paint-btn-color')) || '';
|
|
299
|
-
const normalized = currentBtnHex.trim() || '#B3E5FC';
|
|
300
|
-
const match = Array.from(grid.children).find((el) => {
|
|
301
|
-
const bg = el && el.style && el.style.background ? el.style.background.toLowerCase() : '';
|
|
302
|
-
return bg === normalized.toLowerCase();
|
|
303
|
-
});
|
|
304
|
-
if (match) match.classList.add('is-active');
|
|
305
|
-
} catch (_) {}
|
|
304
|
+
// (дополнительная подсветка не требуется — активируем по data-hex выше)
|
|
306
305
|
|
|
307
306
|
this.element.appendChild(pop);
|
|
308
307
|
this._paintPopover = pop;
|