Skip to content

Commit

Permalink
Fix wled#1400: Using sliders / colorwheel sometimes slides the whole …
Browse files Browse the repository at this point in the history
…UI (wled#1459)

* Prevent UI from sliding when using sliders (wled#1400)

An iro.js version bump in commit 98e4ac6 changed names for the slider &
colorwheel classes which made the filter in function lock() fail.

Also it seems that not all elements of the Iro sliders & colorwheel have
appropriate classes set. Just changing the names still sometimes failed
when the user accidentally grabbed a part of the slider / colorwheel
that has no class name set.

To mitigate this, lock() now checks the events classlist for classes
starting with "Iro" as well as it's parents classlist if no "Iro" classes
were found

* Regenerate wled00/html_ui.h
  • Loading branch information
allgoewer authored Dec 9, 2020
1 parent bdaef7e commit 7684fb8
Show file tree
Hide file tree
Showing 2 changed files with 1,433 additions and 1,421 deletions.
15 changes: 14 additions & 1 deletion wled00/data/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -2443,10 +2443,23 @@

function unify(e) { return e.changedTouches ? e.changedTouches[0] : e }

function hasIroClass(classList) {
for (var i = 0; i < classList.length; i++) {
var element = classList[i];
if (element.startsWith('Iro')) return true;
}

return false;
}


function lock(e) {
if (pcMode) return;
var l = e.target.classList;
if (l.contains('noslide') || l.contains('iro__wheel__saturation') || l.contains('iro__slider__value') || l.contains('iro__slider')) return;
var pl = e.target.parentElement.classList;

if (l.contains('noslide') || hasIroClass(l) || hasIroClass(pl)) return;

x0 = unify(e).clientX;
scrollS = d.getElementsByClassName("tabcontent")[iSlide].scrollTop;

Expand Down
Loading

0 comments on commit 7684fb8

Please sign in to comment.