mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Allowed setting of new forceUpdateDisplay property to override default behaviour of preventing updates to active select inputs
This commit is contained in:
parent
c2edd82e39
commit
fd9b5bc5fc
@ -52,6 +52,12 @@ class Controller {
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
this.__onFinishChange = undefined;
|
this.__onFinishChange = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wether to force update a display, even when active.
|
||||||
|
* @type boolean
|
||||||
|
*/
|
||||||
|
this.forceUpdateDisplay = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +76,7 @@ class OptionController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateDisplay() {
|
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();
|
this.__select.value = this.getValue();
|
||||||
return super.updateDisplay();
|
return super.updateDisplay();
|
||||||
}
|
}
|
||||||
|
@ -974,7 +974,8 @@ function augmentController(gui, li, controller) {
|
|||||||
* Sets controller to listen for changes on its underlying object.
|
* Sets controller to listen for changes on its underlying object.
|
||||||
* @return {Controller}
|
* @return {Controller}
|
||||||
*/
|
*/
|
||||||
listen: function() {
|
listen: function(forceUpdateDisplay) {
|
||||||
|
controller.forceUpdateDisplay = !!forceUpdateDisplay;
|
||||||
controller.__gui.listen(controller);
|
controller.__gui.listen(controller);
|
||||||
return controller;
|
return controller;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user