encoder: add mousewheel support (issue #71)
This commit is contained in:
parent
7f3686ff57
commit
7d797ed9a4
1 changed files with 17 additions and 0 deletions
|
|
@ -165,6 +165,23 @@ module.exports = class Encoder extends _widgets_base {
|
|||
})
|
||||
})
|
||||
|
||||
this.wrapper.on('mousewheel', (e)=>{
|
||||
|
||||
if (e.originalEvent.wheelDeltaX || e.originalEvent.wheelDelta == 0) return
|
||||
|
||||
var direction = e.originalEvent.wheelDelta / Math.abs(e.originalEvent.wheelDelta)
|
||||
|
||||
this.display.setValue(this.display.value + direction)
|
||||
this.setValue(direction < 0 ? this.getProp('back') : this.getProp('forth'), {sync:true, send:true})
|
||||
|
||||
if (this.getProp('release') !== '' && this.value !== this.getProp('release')) {
|
||||
this.knob.setValue(this.ticks/2)
|
||||
this.display.setValue(this.ticks/2)
|
||||
this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
setValue(v,options={}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue