virtual-tree-canvas 0.3.2 → 0.3.4
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
|
@@ -73,6 +73,7 @@ export class IconRegistry {
|
|
|
73
73
|
this.register('warning', drawWarning);
|
|
74
74
|
this.register('error', drawError);
|
|
75
75
|
this.register('task', drawTask);
|
|
76
|
+
this.register('bus', drawBus);
|
|
76
77
|
this.register('track', drawTrack);
|
|
77
78
|
this.register('point', drawPoint);
|
|
78
79
|
this.register('munition', drawMunition);
|
|
@@ -173,6 +174,33 @@ function drawTask(ctx, x, y, size, color) {
|
|
|
173
174
|
ctx.stroke();
|
|
174
175
|
}
|
|
175
176
|
|
|
177
|
+
function drawBus(ctx, x, y, size, color) {
|
|
178
|
+
const left = x + size * 0.22;
|
|
179
|
+
const right = x + size * 0.82;
|
|
180
|
+
const ys = [y + size * 0.32, y + size * 0.5, y + size * 0.68];
|
|
181
|
+
ctx.strokeStyle = color;
|
|
182
|
+
ctx.fillStyle = color;
|
|
183
|
+
ctx.lineWidth = 1.25;
|
|
184
|
+
|
|
185
|
+
ctx.beginPath();
|
|
186
|
+
ctx.moveTo(left, ys[0]);
|
|
187
|
+
ctx.lineTo(right, ys[0]);
|
|
188
|
+
ctx.moveTo(left, ys[1]);
|
|
189
|
+
ctx.lineTo(right, ys[1]);
|
|
190
|
+
ctx.moveTo(left, ys[2]);
|
|
191
|
+
ctx.lineTo(right, ys[2]);
|
|
192
|
+
ctx.moveTo(left, ys[0]);
|
|
193
|
+
ctx.lineTo(left, ys[2]);
|
|
194
|
+
ctx.stroke();
|
|
195
|
+
|
|
196
|
+
for (const cy of ys) {
|
|
197
|
+
ctx.beginPath();
|
|
198
|
+
ctx.arc(left, cy, size * 0.075, 0, Math.PI * 2);
|
|
199
|
+
ctx.arc(right, cy, size * 0.075, 0, Math.PI * 2);
|
|
200
|
+
ctx.fill();
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
176
204
|
function drawTrack(ctx, x, y, size, color) {
|
|
177
205
|
ctx.strokeStyle = color;
|
|
178
206
|
ctx.lineWidth = 1.5;
|
|
@@ -38,6 +38,7 @@ export const darkTheme = {
|
|
|
38
38
|
warning: { icon: 'warning', color: '#facc15' },
|
|
39
39
|
error: { icon: 'error', color: '#ef4444' },
|
|
40
40
|
task: { icon: 'task', color: '#f97316' },
|
|
41
|
+
bus: { icon: 'bus', color: '#22d3ee' },
|
|
41
42
|
object: { icon: 'inspector-object', color: '#7dd3fc' },
|
|
42
43
|
array: { icon: 'inspector-array', color: '#a78bfa' },
|
|
43
44
|
string: { icon: 'inspector-value', color: '#94a3b8' },
|
|
@@ -108,6 +109,7 @@ export const tacticalTheme = {
|
|
|
108
109
|
damage: { icon: 'damage', color: '#ff8fab' },
|
|
109
110
|
warning: { icon: 'warning', color: '#ffd166' },
|
|
110
111
|
error: { icon: 'error', color: '#ff5c5c' },
|
|
112
|
+
bus: { icon: 'bus', color: '#67e8f9' },
|
|
111
113
|
},
|
|
112
114
|
};
|
|
113
115
|
|
|
@@ -101,7 +101,10 @@ export class CellEditorManager {
|
|
|
101
101
|
padding: data.editorType === 'color' ? '0 2px' : data.editorType === 'select' ? '0 22px 0 8px' : '0 8px',
|
|
102
102
|
textAlign: data.editorType === 'number' || data.editorType === 'range' ? 'right' : 'left',
|
|
103
103
|
});
|
|
104
|
+
let committed = false;
|
|
104
105
|
const commit = () => {
|
|
106
|
+
if (committed) return;
|
|
107
|
+
committed = true;
|
|
105
108
|
const nextValue = parseEditorValue(element, data);
|
|
106
109
|
this.controller.updateInspectorValue(node.id, nextValue, data.editorType);
|
|
107
110
|
this.#removeOverlay();
|
|
@@ -110,6 +113,9 @@ export class CellEditorManager {
|
|
|
110
113
|
if (event.key === 'Enter') commit();
|
|
111
114
|
else if (event.key === 'Escape') this.#removeOverlay();
|
|
112
115
|
});
|
|
116
|
+
if (data.editorType === 'select') {
|
|
117
|
+
element.addEventListener('change', commit);
|
|
118
|
+
}
|
|
113
119
|
element.addEventListener('blur', commit);
|
|
114
120
|
ensureOverlayHost(this.host);
|
|
115
121
|
this.host.append(element);
|