Trying to make unselectable

This commit is contained in:
George Michael Brower 2011-01-24 14:45:31 -07:00
parent 58447b25c1
commit b8323ce896
3 changed files with 10 additions and 7 deletions

View File

@ -12,6 +12,13 @@ var Controller = function() {
return this.object[this.propertyName]; return this.object[this.propertyName];
} }
this.makeUnselectable = function(elem) {
elem.onselectstart = function() { return false; };
elem.style.MozUserSelect = "none";
elem.style.KhtmlUserSelect = "none";
elem.unselectable = "on";
}
this.domElement = document.createElement('div'); this.domElement = document.createElement('div');
this.domElement.setAttribute('class', 'guidat-controller ' + this.type); this.domElement.setAttribute('class', 'guidat-controller ' + this.type);
@ -23,12 +30,6 @@ var Controller = function() {
this.setName(this.propertyName); this.setName(this.propertyName);
this.domElement.appendChild(this.propertyNameElement); this.domElement.appendChild(this.propertyNameElement);
makeUnselectable(this.domElement); this.makeUnselectable(this.domElement);
function makeUnselectable(elem) {
elem.onselectstart = function() { return false; };
elem.style.MozUserSelect = "none";
elem.style.KhtmlUserSelect = "none";
elem.unselectable = "on";
}
}; };

View File

@ -65,6 +65,7 @@ var NumberController = function() {
button.value = inc; button.value = inc;
_this.setValue(inc); _this.setValue(inc);
} }
return false;
}, false); }, false);
this.__defineSetter__("position", function(val) { this.__defineSetter__("position", function(val) {

View File

@ -78,6 +78,7 @@
} }
.guidat-controller.number input[type=number] { .guidat-controller.number input[type=number] {
width: 45px; width: 45px;
cursor: ns-resize;
} }
.guidat-controller.boolean input { .guidat-controller.boolean input {