Fix #1400: Using sliders / colorwheel sometimes slides the whole UI (#1459)

* Prevent UI from sliding when using sliders (#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
This commit is contained in:
Maik Allgöwer 2020-12-09 14:08:05 +01:00 committed by GitHub
parent bdaef7e541
commit 7684fb83d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1433 additions and 1421 deletions

View File

@ -2443,10 +2443,23 @@ let iSlide = 0, x0 = null, scrollS = 0, locked = false, w;
function unify(e) { return e.changedTouches ? e.changedTouches[0] : e } 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) { function lock(e) {
if (pcMode) return; if (pcMode) return;
var l = e.target.classList; 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; x0 = unify(e).clientX;
scrollS = d.getElementsByClassName("tabcontent")[iSlide].scrollTop; scrollS = d.getElementsByClassName("tabcontent")[iSlide].scrollTop;

File diff suppressed because it is too large Load Diff