diff --git a/controller.js b/controller.js index d88e86e..719b420 100644 --- a/controller.js +++ b/controller.js @@ -19,6 +19,13 @@ var Controller = function() { elem.unselectable = "on"; } + this.makeSelectable = function(elem) { + elem.onselectstart = function() { }; + elem.style.MozUserSelect = "auto"; + elem.style.KhtmlUserSelect = "auto"; + elem.unselectable = "off"; + } + this.domElement = document.createElement('div'); this.domElement.setAttribute('class', 'guidat-controller ' + this.type); diff --git a/controller.number.js b/controller.number.js index e0b4d1a..c8c2340 100644 --- a/controller.number.js +++ b/controller.number.js @@ -58,13 +58,18 @@ var NumberController = function() { }, false); document.addEventListener('mouseup', function(e) { isClicked = false; + _this.makeSelectable(GUI.domElement); + _this.makeSelectable(button); isDragged = false; }, false); document.addEventListener('mousemove', function(e) { if(isClicked) { e.preventDefault(); + _this.makeUnselectable(GUI.domElement); + _this.makeUnselectable(button); + py = y; - y = e.offsetY; + y = e.offsetY; var dy = y - py; if(dy < 0) { diff --git a/controller.string.js b/controller.string.js index 679e59c..aa955ea 100644 --- a/controller.string.js +++ b/controller.string.js @@ -11,6 +11,7 @@ var StringController = function() { var initialValue = this.getValue(); input.setAttribute('value', initialValue); + input.setAttribute('spellcheck', 'false'); this.domElement.addEventListener('mouseup', function() { input.focus(); input.select(); @@ -20,13 +21,6 @@ var StringController = function() { _this.setValue(input.value); }, false); - input.addEventListener('blur', function(e) { - if(_this.getValue() == '') { - _this.setValue(initialValue); - this.value = initialValue; - } - }, false); - this.domElement.appendChild(input); }; StringController.prototype = new Controller(); diff --git a/demo.html b/demo.html index b80691d..bff85f0 100644 --- a/demo.html +++ b/demo.html @@ -3,12 +3,13 @@ + + -