Slider: ask what the screens height is

Should make this more likely to work on different size screens.
master
thyttan 2023-10-09 00:09:53 +02:00
parent 408990d919
commit bcb6e0ca01
1 changed files with 2 additions and 1 deletions

View File

@ -69,6 +69,7 @@ try { // For making it possiblie to run the test app in the following catch stat
// Only add interactivity if wanted. // Only add interactivity if wanted.
if (o.c.dragableSlider) { if (o.c.dragableSlider) {
const Y_MAX = g.getHeight()-1; // Should this take users screen calibration into account?
o.v.ebLast = 0; o.v.ebLast = 0;
o.v.dy = 0; o.v.dy = 0;
@ -104,7 +105,7 @@ try { // For making it possiblie to run the test app in the following catch stat
if (o.c.useMap && o.f.wasOnIndicator(exFirst)) { // If draging starts on the indicator, adjust one-to-one. if (o.c.useMap && o.f.wasOnIndicator(exFirst)) { // If draging starts on the indicator, adjust one-to-one.
let input = !o.c.horizontal? let input = !o.c.horizontal?
Math.min((175-e.y)-o.c.yStart-3*o.c.rounded/4, o.c.height): Math.min((Y_MAX-e.y)-o.c.yStart-3*o.c.rounded/4, o.c.height):
Math.min(e.x-o.c.xStart-3*o.c.rounded/4, o.c.width); Math.min(e.x-o.c.xStart-3*o.c.rounded/4, o.c.width);
input = Math.round(input/o.c.STEP_SIZE); input = Math.round(input/o.c.STEP_SIZE);