Fix UI handling of in-between inactive segments

This commit is contained in:
cschwinne 2023-07-14 01:12:19 +02:00
parent 6302056182
commit ae235aa58c
2 changed files with 2005 additions and 2003 deletions

View File

@ -826,6 +826,7 @@ function populateSegments(s)
resetUtil(noNewSegs); resetUtil(noNewSegs);
if (gId('selall')) gId('selall').checked = true; if (gId('selall')) gId('selall').checked = true;
for (var i = 0; i <= lSeg; i++) { for (var i = 0; i <= lSeg; i++) {
if (!gId(`seg${i}`)) continue;
updateLen(i); updateLen(i);
updateTrail(gId(`seg${i}bri`)); updateTrail(gId(`seg${i}bri`));
gId(`segr${i}`).classList.add("hide"); gId(`segr${i}`).classList.add("hide");
@ -2051,14 +2052,14 @@ function tglSegn(s)
function selSegAll(o) function selSegAll(o)
{ {
var obj = {"seg":[]}; var obj = {"seg":[]};
for (let i=0; i<=lSeg; i++) obj.seg.push({"id":i,"sel":o.checked}); for (let i=0; i<=lSeg; i++) if (gId(`seg${i}`)) obj.seg.push({"id":i,"sel":o.checked});
requestJson(obj); requestJson(obj);
} }
function selSegEx(s) function selSegEx(s)
{ {
var obj = {"seg":[]}; var obj = {"seg":[]};
for (let i=0; i<=lSeg; i++) obj.seg.push({"id":i,"sel":(i==s)}); for (let i=0; i<=lSeg; i++) if (gId(`seg${i}`)) obj.seg.push({"id":i,"sel":(i==s)});
obj.mainseg = s; obj.mainseg = s;
requestJson(obj); requestJson(obj);
} }
@ -2076,7 +2077,7 @@ function selGrp(g)
event.stopPropagation(); event.stopPropagation();
var sel = gId(`segcont`).querySelectorAll(`div[data-set="${g}"]`); var sel = gId(`segcont`).querySelectorAll(`div[data-set="${g}"]`);
var obj = {"seg":[]}; var obj = {"seg":[]};
for (let i=0; i<=lSeg; i++) obj.seg.push({"id":i,"sel":false}); for (let i=0; i<=lSeg; i++) if (gId(`seg${i}`)) obj.seg.push({"id":i,"sel":false});
if (sel) for (let s of sel||[]) { if (sel) for (let s of sel||[]) {
let i = parseInt(s.id.substring(3)); let i = parseInt(s.id.substring(3));
obj.seg[i] = {"id":i,"sel":true}; obj.seg[i] = {"id":i,"sel":true};

File diff suppressed because it is too large Load Diff