mirror of
https://github.com/wled/WLED.git
synced 2025-07-13 22:06:31 +00:00
Fix for empty WS reponse.
Scroll selected preset into view.
This commit is contained in:
parent
bfab2d405b
commit
e539a36ae7
@ -215,8 +215,8 @@ function onLoad()
|
||||
var mySocket = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws');
|
||||
mySocket.onmessage = function(event) {
|
||||
var json = JSON.parse(event.data);
|
||||
handleJson(json.state);
|
||||
updateUI(true);
|
||||
//console.log(json);
|
||||
if (handleJson(json.state)) updateUI(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -493,7 +493,7 @@ function populatePresets(fromls)
|
||||
if (expanded[i+100]) expand(i+100, true);
|
||||
}
|
||||
} else { presetError(true); }
|
||||
updatePA();
|
||||
updatePA(true);
|
||||
populateQL();
|
||||
}
|
||||
|
||||
@ -867,7 +867,7 @@ function updateLen(s)
|
||||
d.getElementById(`seg${s}len`).innerHTML = out;
|
||||
}
|
||||
|
||||
function updatePA()
|
||||
function updatePA(scrollto=false)
|
||||
{
|
||||
var ps = d.getElementsByClassName("seg");
|
||||
for (let i = 0; i < ps.length; i++) {
|
||||
@ -879,8 +879,16 @@ function updatePA()
|
||||
}
|
||||
if (currentPreset > 0) {
|
||||
var acv = d.getElementById(`p${currentPreset}o`);
|
||||
if (acv && !expanded[currentPreset+100])
|
||||
if (acv && !expanded[currentPreset+100]) {
|
||||
acv.style.background = "var(--c-6)";
|
||||
if (scrollto) {
|
||||
// scroll selected preset into view (on WS refresh)
|
||||
acv.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
});
|
||||
}
|
||||
}
|
||||
acv = d.getElementById(`p${currentPreset}qlb`);
|
||||
if (acv) acv.style.background = "var(--c-6)";
|
||||
}
|
||||
@ -901,7 +909,7 @@ function updateUI(scrollto=false)
|
||||
updateTrail(d.getElementById('sliderW'));
|
||||
if (isRgbw) d.getElementById('wwrap').style.display = "block";
|
||||
|
||||
updatePA();
|
||||
updatePA(scrollto);
|
||||
updateHex();
|
||||
updateRgb();
|
||||
}
|
||||
|
1639
wled00/html_ui.h
1639
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2103191
|
||||
#define VERSION 2103201
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
|
Loading…
x
Reference in New Issue
Block a user