diff --git a/src/dat/controllers/Controller.js b/src/dat/controllers/Controller.js index b65c774..7c39f61 100644 --- a/src/dat/controllers/Controller.js +++ b/src/dat/controllers/Controller.js @@ -52,6 +52,12 @@ class Controller { * @ignore */ this.__onFinishChange = undefined; + + /** + * Wether to force update a display, even when active. + * @type boolean + */ + this.forceUpdateDisplay = false; } /** diff --git a/src/dat/controllers/OptionController.js b/src/dat/controllers/OptionController.js index b349031..98e5a22 100644 --- a/src/dat/controllers/OptionController.js +++ b/src/dat/controllers/OptionController.js @@ -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(); } diff --git a/src/dat/gui/GUI.js b/src/dat/gui/GUI.js index 972c307..0d9059c 100644 --- a/src/dat/gui/GUI.js +++ b/src/dat/gui/GUI.js @@ -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; },