mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
35 lines
771 B
JavaScript
35 lines
771 B
JavaScript
var StringController = function() {
|
|
|
|
this.type = "string";
|
|
|
|
var that = this;
|
|
|
|
Controller.apply(this, arguments);
|
|
|
|
this.value = this.getTargetValue();
|
|
|
|
var input = document.createElement('input');
|
|
input.setAttribute('value', this.value);
|
|
input.setAttribute('spellcheck', 'false');
|
|
|
|
this.domElement.addEventListener('mouseup', function() {
|
|
input.focus();
|
|
input.select();
|
|
}, false);
|
|
|
|
input.addEventListener('keyup', function() {
|
|
that.updateValue(input.value);
|
|
that.setTargetValue(that.value);
|
|
}, false);
|
|
|
|
this.domElement.appendChild(input);
|
|
|
|
this.updateValue = function(val) {
|
|
that.value = val;
|
|
input.setAttribute('value', that.value);
|
|
}
|
|
|
|
};
|
|
StringController.prototype = new Controller();
|
|
StringController.prototype.constructor = StringController;
|