dropdown: allow resubmitting the same value
This commit is contained in:
parent
5f4c2c60be
commit
b555169cef
3 changed files with 15 additions and 1 deletions
|
|
@ -6,6 +6,8 @@
|
|||
- scripting: `getProp()` now correctly returns a copy of the property if it is an object
|
||||
- prevent infinite loop when loading widgets with complex inter-dependencies
|
||||
|
||||
- widgets
|
||||
- dropdown: allow resubmitting the same value
|
||||
|
||||
## 1.25.7
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ class Dropdown extends MenuBase {
|
|||
this.setValue(this.values[this.select.selectedIndex], {sync:true, send:true, fromLocal:true})
|
||||
}, {element: this.select})
|
||||
|
||||
this.on('fast-click', (e)=>{
|
||||
// allow resubmitting same value
|
||||
this.select.selectedIndex = -1
|
||||
}, {element: this.select})
|
||||
|
||||
|
||||
this.select.selectedIndex = -1
|
||||
this.selected = -1
|
||||
this.container.classList.add('noselect')
|
||||
|
|
@ -95,6 +101,10 @@ class Dropdown extends MenuBase {
|
|||
this.select.blur()
|
||||
}
|
||||
|
||||
for (var j = 0; j < this.select.options.length; j++) {
|
||||
this.select.options[j].classList.toggle('on', i === j)
|
||||
}
|
||||
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.changed(options)
|
||||
|
||||
|
|
|
|||
|
|
@ -538,7 +538,9 @@
|
|||
background: var(--color-background);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
option.on {
|
||||
background: var(--color-fill)
|
||||
}
|
||||
}
|
||||
|
||||
.editor-enabled {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue