2011-01-24 10:36:57 +00:00
|
|
|
var Controller = function() {
|
2011-01-24 02:59:29 +00:00
|
|
|
|
2011-01-24 20:11:19 +00:00
|
|
|
this.setName = function(n) {
|
2011-01-24 02:59:29 +00:00
|
|
|
this.propertyNameElement.innerHTML = n;
|
|
|
|
}
|
2011-01-24 20:11:19 +00:00
|
|
|
|
|
|
|
this.setValue = function(n) {
|
|
|
|
this.object[this.propertyName] = n;
|
|
|
|
}
|
|
|
|
|
2011-01-24 21:09:55 +00:00
|
|
|
this.getValue = function() {
|
|
|
|
return this.object[this.propertyName];
|
|
|
|
}
|
|
|
|
|
2011-01-24 21:45:31 +00:00
|
|
|
this.makeUnselectable = function(elem) {
|
|
|
|
elem.onselectstart = function() { return false; };
|
|
|
|
elem.style.MozUserSelect = "none";
|
|
|
|
elem.style.KhtmlUserSelect = "none";
|
|
|
|
elem.unselectable = "on";
|
|
|
|
}
|
|
|
|
|
2011-01-24 22:08:48 +00:00
|
|
|
this.makeSelectable = function(elem) {
|
|
|
|
elem.onselectstart = function() { };
|
|
|
|
elem.style.MozUserSelect = "auto";
|
|
|
|
elem.style.KhtmlUserSelect = "auto";
|
|
|
|
elem.unselectable = "off";
|
|
|
|
}
|
|
|
|
|
2011-01-24 00:15:04 +00:00
|
|
|
this.domElement = document.createElement('div');
|
2011-01-24 02:59:29 +00:00
|
|
|
this.domElement.setAttribute('class', 'guidat-controller ' + this.type);
|
2011-01-24 00:50:14 +00:00
|
|
|
|
2011-01-24 00:02:15 +00:00
|
|
|
this.object = arguments[0];
|
|
|
|
this.propertyName = arguments[1];
|
2011-01-24 00:50:14 +00:00
|
|
|
|
|
|
|
this.propertyNameElement = document.createElement('span');
|
|
|
|
this.propertyNameElement.setAttribute('class', 'guidat-propertyname');
|
2011-01-24 20:11:19 +00:00
|
|
|
this.setName(this.propertyName);
|
2011-01-24 00:50:14 +00:00
|
|
|
this.domElement.appendChild(this.propertyNameElement);
|
2011-01-24 02:59:29 +00:00
|
|
|
|
2011-01-24 21:45:31 +00:00
|
|
|
this.makeUnselectable(this.domElement);
|
2011-01-24 02:59:29 +00:00
|
|
|
|
2011-01-24 19:38:52 +00:00
|
|
|
};
|