dat.gui/controller.string.js

34 lines
896 B
JavaScript
Raw Normal View History

var StringController = function() {
this.type = "string";
var _this = this;
Controller.apply(this, arguments);
var input = document.createElement('input');
input.setAttribute('value', this.object[this.propertyName]);
this.domElement.addEventListener('mouseup', function() {
input.focus();
input.select();
}, false);
input.addEventListener('keyup', function() {
console.log(input.value);
_this.setValue(input.value);
}, false);
this.domElement.appendChild(input);
2011-01-24 20:53:33 +00:00
input.onfocus = function(e) {
if(_this.contents == _this.object[_this.propertyName]) {
contents = "";
_this.input.setAttribute('value', contents);
}
};
input.onblur = function(e) {
};
};
StringController.prototype = new Controller();
StringController.prototype.constructor = StringController;