mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
addEventListener-fied NavigationController
This commit is contained in:
parent
a9b391e971
commit
76278bf1a0
@ -24,10 +24,10 @@ var NumberController = function() {
|
|||||||
button.setAttribute('value', inc)
|
button.setAttribute('value', inc)
|
||||||
this.domElement.appendChild(button);
|
this.domElement.appendChild(button);
|
||||||
|
|
||||||
button.onmousedown = function(e) {
|
button.addEventListener('mousedown', function(e) {
|
||||||
isClicked = true;
|
isClicked = true;
|
||||||
};
|
}, false);
|
||||||
button.onkeyup = function(e) {
|
button.addEventListener('keyup', function(e) {
|
||||||
var val = parseFloat(this.value);
|
var val = parseFloat(this.value);
|
||||||
if(isNaN(val)) {
|
if(isNaN(val)) {
|
||||||
inc = initialValue;
|
inc = initialValue;
|
||||||
@ -36,11 +36,11 @@ var NumberController = function() {
|
|||||||
}
|
}
|
||||||
this.value = inc;
|
this.value = inc;
|
||||||
_this.setValue(inc);
|
_this.setValue(inc);
|
||||||
}
|
}, false);
|
||||||
document.onmouseup = function(e) {
|
document.addEventListener('mouseup', function(e) {
|
||||||
isClicked = false;
|
isClicked = false;
|
||||||
};
|
}, false);
|
||||||
document.onmousemove = function(e) {
|
document.addEventListener('mousemove', function(e) {
|
||||||
if(isClicked) {
|
if(isClicked) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
py = y;
|
py = y;
|
||||||
@ -61,7 +61,7 @@ var NumberController = function() {
|
|||||||
button.value = inc;
|
button.value = inc;
|
||||||
_this.setValue(inc);
|
_this.setValue(inc);
|
||||||
}
|
}
|
||||||
};
|
}, false);
|
||||||
|
|
||||||
this.__defineSetter__("position", function(val) {
|
this.__defineSetter__("position", function(val) {
|
||||||
inc = val;
|
inc = val;
|
||||||
|
@ -20,12 +20,12 @@ var StringController = function() {
|
|||||||
_this.setValue(input.value);
|
_this.setValue(input.value);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
input.onblur = function(e) {
|
input.addEventListener('blur', function(e) {
|
||||||
if(_this.getValue() == '') {
|
if(_this.getValue() == '') {
|
||||||
_this.setValue(initialValue);
|
_this.setValue(initialValue);
|
||||||
this.value = initialValue;
|
this.value = initialValue;
|
||||||
}
|
}
|
||||||
};
|
}, false);
|
||||||
|
|
||||||
this.domElement.appendChild(input);
|
this.domElement.appendChild(input);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user