slider: use standard wheel event (& firefox compatible)

This commit is contained in:
bordun 2020-04-24 14:41:23 +02:00
parent e83b7ce99d
commit 94fd7f2011
2 changed files with 5 additions and 5 deletions

View file

@ -64,7 +64,7 @@ class Slider extends Canvas {
}
this.widget.addEventListener('mousewheel',this.mousewheelHandleProxy.bind(this))
this.widget.addEventListener('wheel',this.mousewheelHandleProxy.bind(this))
touchstate(this, {element: this.widget, multitouch: options.multitouch})
@ -104,13 +104,13 @@ class Slider extends Canvas {
mousewheelHandle(e) {
if (e.wheelDeltaX) return
if (e.deltaX) return
e.preventDefault()
e.stopPropagation()
var direction = e.wheelDelta / Math.abs(e.wheelDelta),
increment = e.ctrlKey?0.25:1
var direction = e.deltaY > 0 ? -1 : 1,
increment = e.ctrlKey ? 0.25 : 1
if (this.getProp('steps')) {
var i = this.steps.indexOf(this.value)