mirror of
https://github.com/wled/WLED.git
synced 2025-07-27 12:46:38 +00:00
Hide 2D effects on 1D segments
This commit is contained in:
parent
887254f5da
commit
551b8af76d
@ -1,7 +1,7 @@
|
|||||||
//page js
|
//page js
|
||||||
var loc = false, locip, locproto = "http:";
|
var loc = false, locip, locproto = "http:";
|
||||||
var isOn = false, nlA = false, isLv = false, isInfo = false, isNodes = false, syncSend = false/*, syncTglRecv = true*/;
|
var isOn = false, nlA = false, isLv = false, isInfo = false, isNodes = false, syncSend = false/*, syncTglRecv = true*/;
|
||||||
var hasWhite = false, hasRGB = false, hasCCT = false;
|
var hasWhite = false, hasRGB = false, hasCCT = false, has2D = false;
|
||||||
var nlDur = 60, nlTar = 0;
|
var nlDur = 60, nlTar = 0;
|
||||||
var nlMode = false;
|
var nlMode = false;
|
||||||
var segLmax = 0; // size (in pixels) of largest selected segment
|
var segLmax = 0; // size (in pixels) of largest selected segment
|
||||||
@ -1339,7 +1339,7 @@ function updateSelectedFx()
|
|||||||
if (ds.id>0) {
|
if (ds.id>0) {
|
||||||
if (segLmax==0) fx.classList.add('hide'); // none of the segments selected (hide all effects)
|
if (segLmax==0) fx.classList.add('hide'); // none of the segments selected (hide all effects)
|
||||||
else {
|
else {
|
||||||
if ((segLmax==1 && (!opts[3] || opts[3].indexOf("0")<0)) || (!isM && opts[3] && ((opts[3].indexOf("2")>=0 && opts[3].indexOf("1")<0)))) fx.classList.add('hide');
|
if ((segLmax==1 && (!opts[3] || opts[3].indexOf("0")<0)) || (!has2D && opts[3] && ((opts[3].indexOf("2")>=0 && opts[3].indexOf("1")<0)))) fx.classList.add('hide');
|
||||||
else fx.classList.remove('hide');
|
else fx.classList.remove('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1441,7 +1441,7 @@ function readState(s,command=false)
|
|||||||
populateSegments(s);
|
populateSegments(s);
|
||||||
var selc=0;
|
var selc=0;
|
||||||
var sellvl=0; // 0: selc is invalid, 1: selc is mainseg, 2: selc is first selected
|
var sellvl=0; // 0: selc is invalid, 1: selc is mainseg, 2: selc is first selected
|
||||||
hasRGB = hasWhite = hasCCT = false;
|
hasRGB = hasWhite = hasCCT = has2D = false;
|
||||||
segLmax = 0;
|
segLmax = 0;
|
||||||
for (let i = 0; i < (s.seg||[]).length; i++)
|
for (let i = 0; i < (s.seg||[]).length; i++)
|
||||||
{
|
{
|
||||||
@ -1452,20 +1452,23 @@ function readState(s,command=false)
|
|||||||
if (s.seg[i].sel) {
|
if (s.seg[i].sel) {
|
||||||
if (sellvl < 2) selc = i; // get first selected segment
|
if (sellvl < 2) selc = i; // get first selected segment
|
||||||
sellvl = 2;
|
sellvl = 2;
|
||||||
var lc = lastinfo.leds.seglc[i];
|
let w = (s.seg[i].stop - s.seg[i].start);
|
||||||
|
let h = s.seg[i].stopY ? (s.seg[i].stopY - s.seg[i].startY) : 1;
|
||||||
|
let lc = lastinfo.leds.seglc[i];
|
||||||
hasRGB |= !!(lc & 0x01);
|
hasRGB |= !!(lc & 0x01);
|
||||||
hasWhite |= !!(lc & 0x02);
|
hasWhite |= !!(lc & 0x02);
|
||||||
hasCCT |= !!(lc & 0x04);
|
hasCCT |= !!(lc & 0x04);
|
||||||
let sLen = (s.seg[i].stop - s.seg[i].start)*(s.seg[i].stopY?(s.seg[i].stopY - s.seg[i].startY):1);
|
has2D |= w > 1 && h > 1;
|
||||||
segLmax = segLmax < sLen ? sLen : segLmax;
|
if (w*h > segLmax) segLmax = w*h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var i=s.seg[selc];
|
var i=s.seg[selc];
|
||||||
if (sellvl == 1) {
|
if (sellvl == 1) {
|
||||||
var lc = lastinfo.leds.seglc[selc];
|
let lc = lastinfo.leds.seglc[selc];
|
||||||
hasRGB = !!(lc & 0x01);
|
hasRGB = !!(lc & 0x01);
|
||||||
hasWhite = !!(lc & 0x02);
|
hasWhite = !!(lc & 0x02);
|
||||||
hasCCT = !!(lc & 0x04);
|
hasCCT = !!(lc & 0x04);
|
||||||
|
has2D = (i.stop - i.start) > 1 && (i.stopY ? (i.stopY - i.startY) : 1) > 1;
|
||||||
}
|
}
|
||||||
if (!i) {
|
if (!i) {
|
||||||
showToast('No Segments!', true);
|
showToast('No Segments!', true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user