sliders: make spring and default dynamic
This commit is contained in:
parent
6086802001
commit
bee8b7d814
2 changed files with 14 additions and 6 deletions
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
- bug fixes
|
||||
- launcher: spaces not properly escaped in quoted strings
|
||||
- widgets
|
||||
- sliders: `default` and `spring` properties are now dynamic
|
||||
|
||||
## 0.46.2
|
||||
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ class Slider extends Canvas {
|
|||
this.rangeValsMin:
|
||||
clip(this.getProp('origin'), [this.rangeValsMin,this.rangeValsMax])
|
||||
|
||||
this.springValue = this.getProp('default') !== '' ? this.getProp('default') : this.originValue
|
||||
|
||||
if (this.getProp('doubleTap')) {
|
||||
|
||||
if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') {
|
||||
|
|
@ -62,7 +60,7 @@ class Slider extends Canvas {
|
|||
} else {
|
||||
|
||||
doubletab(this.widget, ()=>{
|
||||
this.setValue(this.springValue,{sync:true, send:true, fromLocal:true})
|
||||
this.setValue(this.getSpringValue(),{sync:true, send:true, fromLocal:true})
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -115,7 +113,7 @@ class Slider extends Canvas {
|
|||
|
||||
this.setSteps()
|
||||
|
||||
this.setValue(this.springValue)
|
||||
this.setValue(this.getSpringValue())
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +174,7 @@ class Slider extends Canvas {
|
|||
dragendHandle(e, data, traversing) {
|
||||
|
||||
if (this.getProp('spring')) {
|
||||
this.setValue(this.springValue,{sync:true,send:true,fromLocal:true})
|
||||
this.setValue(this.getSpringValue(),{sync:true,send:true,fromLocal:true})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -195,6 +193,12 @@ class Slider extends Canvas {
|
|||
|
||||
}
|
||||
|
||||
getSpringValue() {
|
||||
|
||||
return this.getProp('default') !== '' ? this.getProp('default') : this.originValue
|
||||
|
||||
}
|
||||
|
||||
|
||||
percentToValue(percent) {
|
||||
|
||||
|
|
@ -297,7 +301,9 @@ class Slider extends Canvas {
|
|||
Slider.dynamicProps = Slider.prototype.constructor.dynamicProps
|
||||
.filter(n => n !== 'precision')
|
||||
.concat([
|
||||
'steps'
|
||||
'steps',
|
||||
'spring',
|
||||
'default',
|
||||
])
|
||||
|
||||
module.exports = Slider
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue