range: error when setting default property
range: fix `doubleTap` property package: 1.6.0
This commit is contained in:
parent
86f5ac723a
commit
82d199b9f4
4 changed files with 19 additions and 10 deletions
|
|
@ -40,6 +40,7 @@ class Range extends Fader {
|
|||
visible: false,
|
||||
horizontal:this.getProp('horizontal'),
|
||||
default:this.getProp('default').length === 2 ? this.getProp('default')[1] : this.getProp('range').max,
|
||||
origin: this.getProp('default').length === 2 ? this.getProp('default')[1] : this.getProp('range').max,,
|
||||
snap:this.getProp('snap'),
|
||||
spring:this.getProp('spring'),
|
||||
range:this.getProp('range'),
|
||||
|
|
@ -67,10 +68,9 @@ class Range extends Fader {
|
|||
|
||||
this.touchMap = {}
|
||||
|
||||
this.setValue([
|
||||
this.faders[0].rangeValsMin,
|
||||
this.faders[1].rangeValsMax
|
||||
])
|
||||
|
||||
this.originValue = this.faders.map(f => f.originValue)
|
||||
this.setValue(this.getSpringValue())
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -170,15 +170,20 @@ class Range extends Fader {
|
|||
|
||||
setValue(v, options={}) {
|
||||
|
||||
if (!this.faders) return // prevent Fader.constructor
|
||||
if (!v || !v.length || v.length!=2) return
|
||||
|
||||
|
||||
this.faders[0].rangeValsMax = v[1]
|
||||
this.faders[1].rangeValsMin = v[0]
|
||||
|
||||
if (!options.dragged) {
|
||||
this.faders[0].setValue(v[0])
|
||||
this.faders[1].setValue(v[1])
|
||||
var opt = {
|
||||
...options,
|
||||
send: false,
|
||||
sync: false
|
||||
}
|
||||
this.faders[0].setValue(v[0], opt)
|
||||
this.faders[1].setValue(v[1], opt)
|
||||
}
|
||||
this.value = [
|
||||
this.faders[0].getValue(),
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class Slider extends Canvas {
|
|||
} else {
|
||||
|
||||
doubletab(this.widget, ()=>{
|
||||
this.setValue(this.getSpringValue(),{sync:true, send:true, fromLocal:true})
|
||||
this.setValue(this.getSpringValue(),{sync:true, send:true, fromLocal:true, doubleTab:true})
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ class Slider extends Canvas {
|
|||
setValue(v,options={}) {
|
||||
|
||||
if (typeof v != 'number') return
|
||||
if (this.touched && !options.dragged) return this.setValueTouchedQueue = [v, options]
|
||||
if (this.touched && !options.dragged && !options.doubleTab) return this.setValueTouchedQueue = [v, options]
|
||||
|
||||
var value = clip(v,[this.rangeValsMin,this.rangeValsMax])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue