menu/switch/dropdown: reset value to undefined when receiving a value that's not defined in values
This commit is contained in:
parent
db165faa9f
commit
5d37ba109a
3 changed files with 15 additions and 15 deletions
|
|
@ -4,7 +4,10 @@
|
|||
|
||||
- bug fixes
|
||||
- button: all writing strings like `"1.0"` in `label` without removing the decimals
|
||||
- editor: use css variable `--grid-width` at startup (allow overriding) and after disabling & enabling the grid
|
||||
- editor: use css variable `--grid-width` at startup (allow overriding) and after disabling & enabling the grid
|
||||
|
||||
- widgets
|
||||
- menu/switch/dropdown: reset value to `undefined` when receiving a value that's not defined in `values`
|
||||
|
||||
- midi
|
||||
- allow sending note off with velocity
|
||||
|
|
|
|||
|
|
@ -300,17 +300,15 @@ class Menu extends MenuBase {
|
|||
|
||||
var i = this.getIndex(v)
|
||||
|
||||
this.value = this.values[i]
|
||||
this.selected = i
|
||||
DOM.each(this.menu, '.on', (el)=>{el.classList.remove('on')})
|
||||
this.setLabel()
|
||||
|
||||
if (i !== -1) {
|
||||
this.value = this.values[i]
|
||||
this.selected = i
|
||||
DOM.each(this.menu, '.on', (el)=>{el.classList.remove('on')})
|
||||
DOM.get(this.menu, '.item')[i].classList.add('on')
|
||||
|
||||
this.setLabel()
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.changed(options)
|
||||
|
||||
|
|
|
|||
|
|
@ -113,18 +113,17 @@ class Switch extends MenuBase {
|
|||
|
||||
var i = this.getIndex(v)
|
||||
|
||||
this.value = this.values[i]
|
||||
|
||||
DOM.each(this.widget, '.on', (el)=>{el.classList.remove('on')})
|
||||
|
||||
if (i !== -1) {
|
||||
|
||||
this.value = this.values[i]
|
||||
|
||||
DOM.each(this.widget, '.on', (el)=>{el.classList.remove('on')})
|
||||
DOM.get(this.widget, 'value')[i].classList.add('on')
|
||||
|
||||
if (options.send) this.sendValue(this.value)
|
||||
if (options.sync) this.changed(options)
|
||||
}
|
||||
|
||||
if (options.send) this.sendValue(this.value)
|
||||
if (options.sync) this.changed(options)
|
||||
|
||||
}
|
||||
|
||||
setCssVariables() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue