2011-01-25 08:22:04 +00:00
|
|
|
var StringController = function() {
|
2011-01-29 02:25:48 +00:00
|
|
|
|
2011-01-25 08:22:04 +00:00
|
|
|
this.type = "string";
|
2011-01-29 02:25:48 +00:00
|
|
|
|
2011-01-25 08:22:04 +00:00
|
|
|
var _this = this;
|
2011-01-29 02:25:48 +00:00
|
|
|
|
|
|
|
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() {
|
|
|
|
input.focus();
|
|
|
|
input.select();
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
input.addEventListener('keyup', function() {
|
|
|
|
_this.setValue(input.value);
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
this.domElement.appendChild(input);
|
|
|
|
|
|
|
|
this.updateValue = function(val) {
|
|
|
|
input.setAttribute('value', val);
|
|
|
|
}
|
|
|
|
|
2011-01-25 08:22:04 +00:00
|
|
|
};
|
|
|
|
StringController.prototype = new Controller();
|
2011-01-29 02:25:48 +00:00
|
|
|
StringController.prototype.constructor = StringController;
|