Allowed setting of new forceUpdateDisplay property to override default behaviour of preventing updates to active select inputs

This commit is contained in:
David Wakelin 2019-04-08 21:04:46 +01:00
parent c2edd82e39
commit fd9b5bc5fc
3 changed files with 9 additions and 2 deletions

View File

@ -52,6 +52,12 @@ class Controller {
* @ignore
*/
this.__onFinishChange = undefined;
/**
* Wether to force update a display, even when active.
* @type boolean
*/
this.forceUpdateDisplay = false;
}
/**

View File

@ -76,7 +76,7 @@ class OptionController extends Controller {
}
updateDisplay() {
if (dom.isActive(this.__select)) return this; // prevent number from updating if user is trying to manually update
if (dom.isActive(this.__select) && !this.forceUpdateDisplay) return this; // prevent number from updating if user is trying to manually update
this.__select.value = this.getValue();
return super.updateDisplay();
}

View File

@ -974,7 +974,8 @@ function augmentController(gui, li, controller) {
* Sets controller to listen for changes on its underlying object.
* @return {Controller}
*/
listen: function() {
listen: function(forceUpdateDisplay) {
controller.forceUpdateDisplay = !!forceUpdateDisplay;
controller.__gui.listen(controller);
return controller;
},