2011-01-24 19:38:52 +00:00
|
|
|
var StringController = function() {
|
2011-01-24 20:11:19 +00:00
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
this.type = "string";
|
2011-01-24 20:11:19 +00:00
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
Controller.apply(this, arguments);
|
2011-01-24 20:11:19 +00:00
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
var input = document.createElement('input');
|
2011-01-24 20:11:19 +00:00
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
input.setAttribute('value', this.object[this.propertyName]);
|
2011-01-24 20:28:13 +00:00
|
|
|
this.domElement.addEventListener('mouseup', function() {
|
2011-01-24 20:11:19 +00:00
|
|
|
input.focus();
|
2011-01-24 20:28:13 +00:00
|
|
|
input.select();
|
2011-01-24 20:11:19 +00:00
|
|
|
}, false);
|
|
|
|
|
|
|
|
input.addEventListener('keyup', function() {
|
|
|
|
console.log(input.value);
|
|
|
|
_this.setValue(input.value);
|
|
|
|
}, false);
|
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
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) {
|
|
|
|
};
|
2011-01-24 19:38:52 +00:00
|
|
|
};
|
|
|
|
StringController.prototype = new Controller();
|
|
|
|
StringController.prototype.constructor = StringController;
|