fix: guard colormod handlers and drop dead css
Add null guard to /matrix/colormod and /matrix/colorpose WS handlers to prevent TypeError when legacy browser cache holds null color slots. Remove dead CSS rules for .cd-tabs, .cd-tab, .cd-tab.on, .cd-pane[hidden].
This commit is contained in:
@@ -165,10 +165,6 @@ button.queued { animation: queued-blink 600ms ease-in-out infinite alternate; }
|
||||
.cd-colorsel { display:flex; gap:4px; margin:6px 0; }
|
||||
.cd-colorsel button.on { outline:2px solid #fff; }
|
||||
.cd-pattern { display:flex; flex-direction:column; gap:6px; }
|
||||
.cd-tabs { display:flex; gap:4px; margin:6px 0; }
|
||||
.cd-tab { width: auto; padding: 6px 10px; font-size: 12px; }
|
||||
.cd-tab.on { background:#2b6; color:#fff; }
|
||||
.cd-pane[hidden] { display:none; }
|
||||
.cd-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex;
|
||||
align-items: center; justify-content: center; z-index: 50; }
|
||||
.cd-modal[hidden] { display: none; }
|
||||
|
||||
@@ -265,7 +265,7 @@ ws.addEventListener("message", (ev) => {
|
||||
}
|
||||
if (address === "/matrix/colormod") {
|
||||
const vi=Math.round(Number(args[0])), c=Math.round(Number(args[1]));
|
||||
if (vi>=0&&vi<16&&c>=1&&c<=6) {
|
||||
if (vi>=0&&vi<16&&c>=1&&c<=6&&matColorDefs[vi][c]) {
|
||||
const src=String(args[2]??"none");
|
||||
matColorDefs[vi][c].mod = (src==="none") ? null : {source:src, target:String(args[3]??"none"), depth:Number(args[4])||0};
|
||||
saveMatState();
|
||||
@@ -275,7 +275,7 @@ ws.addEventListener("message", (ev) => {
|
||||
}
|
||||
if (address === "/matrix/colorpose") {
|
||||
const vi=Math.round(Number(args[0])), c=Math.round(Number(args[1])), n=Math.round(Number(args[2]));
|
||||
if (vi>=0&&vi<16&&c>=1&&c<=6) {
|
||||
if (vi>=0&&vi<16&&c>=1&&c<=6&&matColorDefs[vi][c]) {
|
||||
matColorDefs[vi][c].pose = [];
|
||||
for (let k=0;k<n;k++){ const b=3+k*2; matColorDefs[vi][c].pose.push({poseId:String(args[b]),action:String(args[b+1])}); }
|
||||
saveMatState();
|
||||
|
||||
Reference in New Issue
Block a user