fix: 修复灯带顺序控件不能很好地被控制。

This commit is contained in:
2023-04-15 11:26:05 +08:00
parent a905c98823
commit 09799cb2d5
2 changed files with 160 additions and 63 deletions

View File

@ -7,6 +7,15 @@ export const [ledStripStore, setLedStripStore] = createStore({
colors: new Uint8ClampedArray(),
sortedColors: new Uint8ClampedArray(),
get totalLedCount() {
return Math.max(0, ...ledStripStore.mappers.map((m) => Math.max(m.start, m.end)));
return Math.max(
0,
...ledStripStore.mappers.map((m) => {
if (m.start === m.end) {
return 0;
} else {
return Math.max(m.start, m.end);
}
}),
);
},
});