Fixed Brightness slider beneath color wheel not working (fixes #1360)

Fixed invalid UI state after saving modified preset
This commit is contained in:
cschwinne 2020-11-21 22:23:00 +01:00
parent 7875a96137
commit bc45f8f1d8
4 changed files with 768 additions and 748 deletions

View File

@ -2,6 +2,11 @@
### Development versions after the 0.10.2 release ### Development versions after the 0.10.2 release
#### Build 2011210
- Fixed Brightness slider beneath color wheel not working (fixes #1360)
- Fixed invalid UI state after saving modified preset
#### Build 2011200 #### Build 2011200
- Added HEX color receiving to JSON API with `"col":["RRGGBBWW"]` format - Added HEX color receiving to JSON API with `"col":["RRGGBBWW"]` format

View File

@ -1139,7 +1139,7 @@ var cpick = new iro.ColorPicker("#picker", {
{ {
component: iro.ui.Slider, component: iro.ui.Slider,
options: { options: {
sliderType: 'brightness' sliderType: 'value'
} }
}, },
{ {
@ -1501,21 +1501,23 @@ function populatePresets(fromls)
var arr = Object.entries(pJson); var arr = Object.entries(pJson);
arr.sort(cmpP); arr.sort(cmpP);
var added = false; var added = false;
pQL = []; pQL = [];
var is = [];
for (var key in arr) for (var key in arr)
{ {
if (!isObject(arr[key][1])) continue; if (!isObject(arr[key][1])) continue;
var i = parseInt(arr[key][0]); var i = parseInt(arr[key][0]);
var qll = arr[key][1]["ql"]; var qll = arr[key][1]["ql"];
if (qll) pQL.push([i, qll]); if (qll) pQL.push([i, qll]);
is.push(i);
cn += `<div class="seg pres" id="p${i}o"> cn += `<div class="seg pres" id="p${i}o">
<div class="segname pname" onclick="setPreset(${i})"> <div class="segname pname" onclick="setPreset(${i})">
${pName(i)} ${pName(i)}
</div> </div>
<i class="icons e-icon flr ${expanded[i+100] ? "exp":""}" id="sege${i+100}" onclick="expand(${i+100})">&#xe395;</i> <i class="icons e-icon flr ${expanded[i+100] ? "exp":""}" id="sege${i+100}" onclick="expand(${i+100})">&#xe395;</i>
<div class="segin ${expanded[i+100] ? "expanded":""}" id="seg${i+100}">${expanded[i+100] ? makeP(i):""}</div> <div class="segin" id="seg${i+100}"></div>
</div><br>`; </div><br>`;
added = true; added = true;
} }
@ -1527,7 +1529,11 @@ function populatePresets(fromls)
pJson["0"] = {}; pJson["0"] = {};
localStorage.setItem("wledP", JSON.stringify(pJson)); localStorage.setItem("wledP", JSON.stringify(pJson));
} }
pmtLS = pmt; pmtLS = pmt;
for (var a in is) {
var i = is[a];
if (expanded[i+100]) expand(i+100, true);
}
} else { presetError(true); } } else { presetError(true); }
updatePA(); updatePA();
populateQL(); populateQL();
@ -2184,12 +2190,16 @@ function saveP(i) {
} }
obj["psave"] = pI; obj["n"] = pN; obj["psave"] = pI; obj["n"] = pN;
var pQN = d.getElementById(`p${i}ql`).value; var pQN = d.getElementById(`p${i}ql`).value;
if (pQN.length > 0) obj["ql"] = pQN; if (pQN.length > 0) obj["ql"] = pQN;
showToast("Saving " + pN +" (" + pI + ")");
requestJson(obj); requestJson(obj);
if (obj["o"]) { if (obj["o"]) {
pJson[pI] = obj; pJson[pI] = obj;
delete pJson[pI]["psave"]; delete pJson[pI]["psave"];
delete pJson[pI]["o"];
delete pJson[pI]["v"];
delete pJson[pI]["time"];
} else { } else {
pJson[pI] = {"n":pN, "win":"Please refresh the page to see this newly saved command."}; pJson[pI] = {"n":pN, "win":"Please refresh the page to see this newly saved command."};
if (obj["win"]) pJson[pI]["win"] = obj["win"]; if (obj["win"]) pJson[pI]["win"] = obj["win"];
@ -2348,9 +2358,9 @@ function rSegs()
requestJson(obj); requestJson(obj);
} }
function expand(i) function expand(i,a)
{ {
expanded[i] = !expanded[i]; if (!a) expanded[i] = !expanded[i];
d.getElementById('seg' +i).style.display = (expanded[i]) ? "block":"none"; d.getElementById('seg' +i).style.display = (expanded[i]) ? "block":"none";
d.getElementById('sege' +i).style.transform = (expanded[i]) ? "rotate(180deg)":"rotate(0deg)" d.getElementById('sege' +i).style.transform = (expanded[i]) ? "rotate(180deg)":"rotate(0deg)"
if (i > 100) { //presets if (i > 100) { //presets

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2011200 #define VERSION 2011210
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG