Skip to content

Commit bc45f8f

Browse files
committed
Fixed Brightness slider beneath color wheel not working (fixes wled#1360)
Fixed invalid UI state after saving modified preset
1 parent 7875a96 commit bc45f8f

File tree

4 files changed

+768
-748
lines changed

4 files changed

+768
-748
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
### Development versions after the 0.10.2 release
44

5+
#### Build 2011210
6+
7+
- Fixed Brightness slider beneath color wheel not working (fixes #1360)
8+
- Fixed invalid UI state after saving modified preset
9+
510
#### Build 2011200
611

712
- Added HEX color receiving to JSON API with `"col":["RRGGBBWW"]` format

wled00/data/index.htm

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@
11391139
{
11401140
component: iro.ui.Slider,
11411141
options: {
1142-
sliderType: 'brightness'
1142+
sliderType: 'value'
11431143
}
11441144
},
11451145
{
@@ -1501,21 +1501,23 @@
15011501
var arr = Object.entries(pJson);
15021502
arr.sort(cmpP);
15031503
var added = false;
1504-
pQL = [];
1504+
pQL = [];
1505+
var is = [];
15051506

15061507
for (var key in arr)
15071508
{
15081509
if (!isObject(arr[key][1])) continue;
15091510
var i = parseInt(arr[key][0]);
15101511
var qll = arr[key][1]["ql"];
1511-
if (qll) pQL.push([i, qll]);
1512+
if (qll) pQL.push([i, qll]);
1513+
is.push(i);
15121514

15131515
cn += `<div class="seg pres" id="p${i}o">
15141516
<div class="segname pname" onclick="setPreset(${i})">
15151517
${pName(i)}
15161518
</div>
15171519
<i class="icons e-icon flr ${expanded[i+100] ? "exp":""}" id="sege${i+100}" onclick="expand(${i+100})">&#xe395;</i>
1518-
<div class="segin ${expanded[i+100] ? "expanded":""}" id="seg${i+100}">${expanded[i+100] ? makeP(i):""}</div>
1520+
<div class="segin" id="seg${i+100}"></div>
15191521
</div><br>`;
15201522
added = true;
15211523
}
@@ -1527,7 +1529,11 @@
15271529
pJson["0"] = {};
15281530
localStorage.setItem("wledP", JSON.stringify(pJson));
15291531
}
1530-
pmtLS = pmt;
1532+
pmtLS = pmt;
1533+
for (var a in is) {
1534+
var i = is[a];
1535+
if (expanded[i+100]) expand(i+100, true);
1536+
}
15311537
} else { presetError(true); }
15321538
updatePA();
15331539
populateQL();
@@ -2184,12 +2190,16 @@
21842190
}
21852191
obj["psave"] = pI; obj["n"] = pN;
21862192
var pQN = d.getElementById(`p${i}ql`).value;
2187-
if (pQN.length > 0) obj["ql"] = pQN;
2193+
if (pQN.length > 0) obj["ql"] = pQN;
21882194

2195+
showToast("Saving " + pN +" (" + pI + ")");
21892196
requestJson(obj);
21902197
if (obj["o"]) {
21912198
pJson[pI] = obj;
2192-
delete pJson[pI]["psave"];
2199+
delete pJson[pI]["psave"];
2200+
delete pJson[pI]["o"];
2201+
delete pJson[pI]["v"];
2202+
delete pJson[pI]["time"];
21932203
} else {
21942204
pJson[pI] = {"n":pN, "win":"Please refresh the page to see this newly saved command."};
21952205
if (obj["win"]) pJson[pI]["win"] = obj["win"];
@@ -2348,9 +2358,9 @@
23482358
requestJson(obj);
23492359
}
23502360

2351-
function expand(i)
2361+
function expand(i,a)
23522362
{
2353-
expanded[i] = !expanded[i];
2363+
if (!a) expanded[i] = !expanded[i];
23542364
d.getElementById('seg' +i).style.display = (expanded[i]) ? "block":"none";
23552365
d.getElementById('sege' +i).style.transform = (expanded[i]) ? "rotate(180deg)":"rotate(0deg)"
23562366
if (i > 100) { //presets

0 commit comments

Comments
 (0)