dat.gui/controllers/controller.string.js

41 lines
990 B
JavaScript
Raw Normal View History

2011-02-02 18:12:55 +00:00
GUI.StringController = function() {
this.type = "string";
var _this = this;
2011-02-02 18:12:55 +00:00
GUI.Controller.apply(this, arguments);
var input = document.createElement('input');
var initialValue = this.getValue();
input.setAttribute('value', initialValue);
input.setAttribute('spellcheck', 'false');
this.domElement.addEventListener('mouseup', function() {
2011-02-08 15:40:38 +00:00
//input.focus();
//input.select();
}, false);
2011-01-31 23:15:29 +00:00
// TODO: getting messed up on ctrl a
input.addEventListener('keyup', function() {
_this.setValue(input.value);
}, false);
input.addEventListener('focus', function() {
GUI.disableKeyListeners = true;
}, false);
input.addEventListener('blur', function() {
GUI.disableKeyListeners = false;
}, false);
this.updateDisplay = function() {
input.value = _this.getValue();
}
this.domElement.appendChild(input);
};
2011-02-02 18:12:55 +00:00
GUI.extendController(GUI.StringController);