Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions js/modules/enable-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,19 @@ const enableSlider = function (
);
});

$handle.addEventListener('touchstart', (e) => {
return this.handlePointerDown(
$handle,
$incrementor,
$decrementor,
e,
);
});
// Use passive: true for touchstart event listeners
$handle.addEventListener(
'touchstart',
(e) => {
return this.handlePointerDown(
$handle,
$incrementor,
$decrementor,
e,
);
},
{ passive: true },
);

window.addEventListener('resize', this.handleResize);

Expand Down Expand Up @@ -866,6 +871,10 @@ const enableSlider = function (
);
}

// Snap the value to the nearest increment
newVal = Math.round(newVal / this.inc) * this.inc;

// Clamp the value within the allowed range
newVal = Math.max(startVal, Math.min(newVal, stopVal));

this.positionHandle($handle, $handleButton, newVal);
Expand Down
25 changes: 17 additions & 8 deletions js/modules/es4/enable-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,19 @@ const enableSlider = function (
);
});

$handle.addEventListener('touchstart', (e) => {
return this.handlePointerDown(
$handle,
$incrementor,
$decrementor,
e,
);
});
// Use passive: true for touchstart event listeners
$handle.addEventListener(
'touchstart',
(e) => {
return this.handlePointerDown(
$handle,
$incrementor,
$decrementor,
e,
);
},
{ passive: true },
);

window.addEventListener('resize', this.handleResize);

Expand Down Expand Up @@ -861,6 +866,10 @@ const enableSlider = function (
);
}

// Snap the value to the nearest increment
newVal = Math.round(newVal / this.inc) * this.inc;

// Clamp the value within the allowed range
newVal = Math.max(startVal, Math.min(newVal, stopVal));

this.positionHandle($handle, $handleButton, newVal);
Expand Down