From c2b26202681d40cdbb4548ce7ecfcd390e4e5d4f Mon Sep 17 00:00:00 2001 From: thyttan <6uuxstm66@mozmail.com⁩> Date: Fri, 29 Sep 2023 00:44:19 +0200 Subject: [PATCH] Slider:map input acounts for size & pos of slider ... and also if the slider is rounded. --- modules/Slider.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/Slider.js b/modules/Slider.js index 4bf2f8ad0..2a522dbda 100644 --- a/modules/Slider.js +++ b/modules/Slider.js @@ -98,11 +98,11 @@ try { // for making it possiblie to run the test app in the following catch stat if (o.v.timeoutID) {clearTimeout(o.v.timeoutID); o.v.timeoutID = undefined;} if (e.b==0 && !o.v.timeoutID && (o.c.timeout || o.c.timeout===0)) o.v.timeoutID = setTimeout(o.f.remove, 1000*o.c.timeout); - let input = Math.min(o.c.horizontal?175-e.x:e.y, 170); - input = Math.round(input/o.c.STEP_SIZE); - if (o.c.useMap && o.f.wasOnIndicator(exFirst)) { // If draging starts on the indicator, adjust one-to-one. + let input = Math.max(0,Math.min((o.c.horizontal?175-e.x:e.y)-o.c.yStart-3*o.c.rounded/4, o.c.height)); + input = Math.round(input/o.c.STEP_SIZE); + o.v.level = Math.min(Math.max(o.c.steps-input,0),o.c.steps); if (o.v.level != o.v.prevLevel) cb("map",o.v.level);