slider: use standard wheel event (& firefox compatible)
This commit is contained in:
parent
2ba3eecc0f
commit
2ad0548517
2 changed files with 5 additions and 5 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
var mod = (navigator.platform || '').match('Mac') ? 'metaKey' : 'ctrlKey'
|
||||
|
||||
document.addEventListener('mousewheel', function(event) {
|
||||
document.addEventListener('wheel', function(event) {
|
||||
if (event.ctrlKey) event.preventDefault()
|
||||
if (event[mod]) {
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue