Fix: numbers were uneditable when using listen()

This commit is contained in:
mike 2016-06-24 08:29:00 -04:00
parent 8f0eba8ade
commit badb5b3b1d
4 changed files with 32 additions and 17 deletions

View File

@ -903,8 +903,11 @@ dat.controllers.NumberControllerBox = (function (NumberController, dom, common)
{
updateDisplay: function() {
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
// Use the same solution from StringController.js to enable
// editing <input>s while "listen()"ing
if (!dom.isActive(this.__input)) {
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
}
return NumberControllerBox.superclass.prototype.updateDisplay.call(this);
}

24
build/dat.gui.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -114,8 +114,11 @@ define([
{
updateDisplay: function() {
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
// Use the same solution from StringController.js to enable
// editing <input>s while "listen()"ing
if (!dom.isActive(this.__input)) {
this.__input.value = this.__truncationSuspended ? this.getValue() : roundToDecimal(this.getValue(), this.__precision);
}
return NumberControllerBox.superclass.prototype.updateDisplay.call(this);
}

View File

@ -6,3 +6,12 @@ require('./builder.js').build({
"shortcut": "dat.GUI",
"paths": {}
});
require('./builder.js').build({
"baseUrl": "../src/",
"main": "dat/gui/GUI",
"out": "../build/dat.gui.min.js",
"minify": true,
"shortcut": "dat.GUI",
"paths": {}
});