diff --git a/js/modules/enable-slider.js b/js/modules/enable-slider.js index b9601b16..48a97949 100755 --- a/js/modules/enable-slider.js +++ b/js/modules/enable-slider.js @@ -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); @@ -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); diff --git a/js/modules/es4/enable-slider.js b/js/modules/es4/enable-slider.js index 5997a440..5c67cb73 100755 --- a/js/modules/es4/enable-slider.js +++ b/js/modules/es4/enable-slider.js @@ -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); @@ -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);