@sequent-org/moodboard 1.4.53 → 1.4.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
package/src/grid/BaseGrid.js
CHANGED
|
@@ -20,6 +20,9 @@ export class BaseGrid {
|
|
|
20
20
|
this.color = options.color;
|
|
21
21
|
this.opacity = options.opacity;
|
|
22
22
|
this.lineWidth = options.lineWidth;
|
|
23
|
+
// Эфемерный override цвета сетки (производный от фона доски, не сериализуется).
|
|
24
|
+
// null — используется штатный цвет/бэнды типа сетки.
|
|
25
|
+
this.colorOverride = null;
|
|
23
26
|
|
|
24
27
|
// Размеры области отрисовки
|
|
25
28
|
this.width = options.width || 1920;
|
|
@@ -169,6 +172,15 @@ export class BaseGrid {
|
|
|
169
172
|
this.color = color;
|
|
170
173
|
this.updateVisual();
|
|
171
174
|
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Устанавливает override-цвет сетки (производный от фона доски).
|
|
178
|
+
* @param {number|null} color — int-цвет либо null для сброса к штатному.
|
|
179
|
+
*/
|
|
180
|
+
setColorOverride(color) {
|
|
181
|
+
this.colorOverride = (typeof color === 'number' && Number.isFinite(color)) ? color : null;
|
|
182
|
+
this.updateVisual();
|
|
183
|
+
}
|
|
172
184
|
|
|
173
185
|
/**
|
|
174
186
|
* Устанавливает прозрачность
|
package/src/grid/CrossGrid.js
CHANGED
|
@@ -38,7 +38,7 @@ export class CrossGrid extends BaseGrid {
|
|
|
38
38
|
const g = this.graphics;
|
|
39
39
|
// Строго без прозрачности.
|
|
40
40
|
g.alpha = 1;
|
|
41
|
-
const lineColor = getCrossColor(this._zoom, this.color);
|
|
41
|
+
const lineColor = this.colorOverride != null ? this.colorOverride : getCrossColor(this._zoom, this.color);
|
|
42
42
|
g.beginFill(lineColor, 1);
|
|
43
43
|
|
|
44
44
|
const checkpoint = getCrossCheckpointForZoom(this._zoom);
|
package/src/grid/DotGrid.js
CHANGED
|
@@ -105,7 +105,7 @@ export class DotGrid extends BaseGrid {
|
|
|
105
105
|
const zoomPct = checkpoint?.zoomPercent ?? 100;
|
|
106
106
|
const use1px = DOT_1PX_CHECKPOINTS.has(zoomPct);
|
|
107
107
|
const dotSize = use1px ? 0.4 : rawDotSize;
|
|
108
|
-
const dotColor = getDotColor(this._zoom, this.color);
|
|
108
|
+
const dotColor = this.colorOverride != null ? this.colorOverride : getDotColor(this._zoom, this.color);
|
|
109
109
|
|
|
110
110
|
this.graphics.beginFill(dotColor, alpha);
|
|
111
111
|
for (let x = startX; x <= endX; x += stepPx) {
|
package/src/grid/LineGrid.js
CHANGED
|
@@ -44,15 +44,21 @@ export class LineGrid extends BaseGrid {
|
|
|
44
44
|
this.graphics.alpha = this.opacity;
|
|
45
45
|
}
|
|
46
46
|
const state = this.getScreenGridState();
|
|
47
|
+
// Miro-профиль: по умолчанию нативная пара цветов. Если из палитры пришёл colorOverride
|
|
48
|
+
// (например светлый фон #f0f6fc с gridColor #d4d4d4), используем его — иначе мелкая сетка
|
|
49
|
+
// сливается с фоном.
|
|
50
|
+
const mainColor = (typeof this.colorOverride === 'number' && Number.isFinite(this.colorOverride))
|
|
51
|
+
? this._deriveMinorColor(this.colorOverride)
|
|
52
|
+
: this.color;
|
|
47
53
|
try {
|
|
48
54
|
this.graphics.lineStyle({
|
|
49
55
|
width: Math.max(1, Math.round(this.lineWidth || 1)),
|
|
50
|
-
color:
|
|
56
|
+
color: mainColor,
|
|
51
57
|
alpha: 1,
|
|
52
58
|
alignment: 0
|
|
53
59
|
});
|
|
54
60
|
} catch (_) {
|
|
55
|
-
this.graphics.lineStyle(Math.max(1, Math.round(this.lineWidth || 1)),
|
|
61
|
+
this.graphics.lineStyle(Math.max(1, Math.round(this.lineWidth || 1)), mainColor, 1);
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
// Основные линии сетки
|
|
@@ -160,15 +166,18 @@ export class LineGrid extends BaseGrid {
|
|
|
160
166
|
const { secondGridStep } = this.getScreenGridState();
|
|
161
167
|
const step = Math.max(1, Math.round(secondGridStep || 0));
|
|
162
168
|
if (step <= 0) return;
|
|
169
|
+
const bigColor = (typeof this.colorOverride === 'number' && Number.isFinite(this.colorOverride))
|
|
170
|
+
? this.colorOverride
|
|
171
|
+
: this.bigGridColor;
|
|
163
172
|
try {
|
|
164
173
|
this.graphics.lineStyle({
|
|
165
174
|
width: 1,
|
|
166
|
-
color:
|
|
175
|
+
color: bigColor,
|
|
167
176
|
alpha: this.bigGridOpacity,
|
|
168
177
|
alignment: 0
|
|
169
178
|
});
|
|
170
179
|
} catch (_) {
|
|
171
|
-
this.graphics.lineStyle(1,
|
|
180
|
+
this.graphics.lineStyle(1, bigColor, this.bigGridOpacity);
|
|
172
181
|
}
|
|
173
182
|
const b = this.getDrawBounds();
|
|
174
183
|
const worldX = this.viewportTransform?.worldX || 0;
|
|
@@ -198,6 +207,18 @@ export class LineGrid extends BaseGrid {
|
|
|
198
207
|
}
|
|
199
208
|
}
|
|
200
209
|
|
|
210
|
+
/**
|
|
211
|
+
* Цвет мелкой сетки из цвета крупной: на 20 светлее на канал, чтобы крупная (override)
|
|
212
|
+
* читалась как заметный якорь, а мелкая была тоньше/бледнее. Для #d4d4d4 даёт #e8e8e8.
|
|
213
|
+
*/
|
|
214
|
+
_deriveMinorColor(bigColor) {
|
|
215
|
+
const delta = 0x14;
|
|
216
|
+
const r = Math.min(0xFF, ((bigColor >> 16) & 0xFF) + delta);
|
|
217
|
+
const g = Math.min(0xFF, ((bigColor >> 8) & 0xFF) + delta);
|
|
218
|
+
const b = Math.min(0xFF, (bigColor & 0xFF) + delta);
|
|
219
|
+
return (r << 16) | (g << 8) | b;
|
|
220
|
+
}
|
|
221
|
+
|
|
201
222
|
_normalizeAnchor(anchor, stepPx) {
|
|
202
223
|
const step = Math.max(1, Math.round(stepPx));
|
|
203
224
|
return ((Math.round(anchor) % step) + step) % step;
|
|
@@ -16,6 +16,20 @@ export class BoardService {
|
|
|
16
16
|
this._destroyed = false;
|
|
17
17
|
this._lastZoomCursor = null;
|
|
18
18
|
this._consumeZoomCursorAnchor = false;
|
|
19
|
+
// Override цвета сетки, производный от фона доски (null — штатный цвет типа сетки).
|
|
20
|
+
this._gridColorOverride = null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Устанавливает override цвета сетки от фона доски и применяет к текущей сетке.
|
|
25
|
+
* Сохраняется, чтобы переехать на новую сетку при смене её типа.
|
|
26
|
+
* @param {number|null} color
|
|
27
|
+
*/
|
|
28
|
+
setGridColorOverride(color) {
|
|
29
|
+
this._gridColorOverride = (typeof color === 'number' && Number.isFinite(color)) ? color : null;
|
|
30
|
+
if (this.grid && typeof this.grid.setColorOverride === 'function') {
|
|
31
|
+
this.grid.setColorOverride(this._gridColorOverride);
|
|
32
|
+
}
|
|
19
33
|
}
|
|
20
34
|
|
|
21
35
|
async init(getCanvasSize) {
|
|
@@ -57,6 +71,9 @@ export class BoardService {
|
|
|
57
71
|
};
|
|
58
72
|
try {
|
|
59
73
|
this.grid = GridFactory.createGrid(type, gridOptions);
|
|
74
|
+
if (this._gridColorOverride != null && typeof this.grid.setColorOverride === 'function') {
|
|
75
|
+
this.grid.setColorOverride(this._gridColorOverride);
|
|
76
|
+
}
|
|
60
77
|
this.pixi.setGrid(this.grid);
|
|
61
78
|
this.refreshGridViewport();
|
|
62
79
|
this.eventBus.emit(Events.UI.GridCurrent, { type });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Events } from '../core/events/Events.js';
|
|
2
|
+
import { BOARD_PALETTE } from '../ui/boardPalette.js';
|
|
2
3
|
|
|
3
4
|
export class SettingsApplier {
|
|
4
5
|
constructor(eventBus, pixi, boardService = null, uiRefs = {}) {
|
|
@@ -43,6 +44,12 @@ export class SettingsApplier {
|
|
|
43
44
|
this.ui.topbar.setPaintButtonHex(this.ui.topbar.mapBoardToBtnHex(boardHex));
|
|
44
45
|
} catch (_) {}
|
|
45
46
|
}
|
|
47
|
+
// Цвет сетки производный от фона: для палитры с заданным gridColor — override, иначе сброс.
|
|
48
|
+
try {
|
|
49
|
+
if (this.boardService && typeof this.boardService.setGridColorOverride === 'function') {
|
|
50
|
+
this.boardService.setGridColorOverride(this._resolveGridColorOverride(bgInt));
|
|
51
|
+
}
|
|
52
|
+
} catch (_) {}
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
// 2) Сетка — применяем только если grid пришёл в partial
|
|
@@ -114,6 +121,21 @@ export class SettingsApplier {
|
|
|
114
121
|
_toHex(intColor) {
|
|
115
122
|
try { return `#${(intColor >>> 0).toString(16).padStart(6, '0')}`.toLowerCase(); } catch (_) { return '#f5f5f5'; }
|
|
116
123
|
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Возвращает int-цвет сетки для фона из палитры (если задан gridColor), иначе null.
|
|
127
|
+
* @param {number|null} bgInt
|
|
128
|
+
* @returns {number|null}
|
|
129
|
+
*/
|
|
130
|
+
_resolveGridColorOverride(bgInt) {
|
|
131
|
+
if (bgInt == null) return null;
|
|
132
|
+
const hex = this._toHex(bgInt);
|
|
133
|
+
const entry = BOARD_PALETTE.find((p) => String(p.board).toLowerCase() === hex);
|
|
134
|
+
if (entry && entry.gridColor) {
|
|
135
|
+
return this._toIntColor(entry.gridColor);
|
|
136
|
+
}
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
117
139
|
}
|
|
118
140
|
|
|
119
141
|
|
package/src/ui/boardPalette.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* btnHex — цвет кнопки в Topbar; board — реальный цвет фона canvas.
|
|
5
5
|
*/
|
|
6
6
|
export const BOARD_PALETTE = [
|
|
7
|
-
{ id: 1, name: 'default-light', btnHex: '#d6e8f7', board: '#f0f6fc' },
|
|
7
|
+
{ id: 1, name: 'default-light', btnHex: '#d6e8f7', board: '#f0f6fc', gridColor: '#d4d4d4' },
|
|
8
8
|
{ id: 2, name: 'mint-light', btnHex: '#E8F5E9', board: '#f8fff7' },
|
|
9
9
|
{ id: 3, name: 'peach-light', btnHex: '#FFF3E0', board: '#fffcf7' },
|
|
10
10
|
{ id: 4, name: 'gray-light', btnHex: '#f5f5f5', board: '#f5f5f5' },
|