mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
fixed the firefox horizontal issue
This commit is contained in:
parent
e79720794f
commit
d099440e0e
@ -36,7 +36,7 @@ Controller.prototype.listen = function() {
|
||||
}
|
||||
|
||||
Controller.prototype.unlisten = function() {
|
||||
this.parent.unlistenTo(this); // <--- hasn't been implemented yet
|
||||
this.parent.unlistenTo(this); // <--- hasn't been tested yet
|
||||
return this;
|
||||
}
|
||||
|
||||
|
5
gui.css
5
gui.css
@ -7,6 +7,11 @@ z-index: 1001;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.guidat * {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.guidat {
|
||||
color: #fff;
|
||||
opacity: 0.97;
|
||||
|
24
gui.js
24
gui.js
@ -37,11 +37,31 @@ var GUI = function() {
|
||||
|
||||
this.domElement = document.createElement('div');
|
||||
this.domElement.setAttribute('class', 'guidat');
|
||||
this.domElement.style.width = width+'px'
|
||||
this.domElement.style.width = width+'px';
|
||||
|
||||
var controllerContainer = document.createElement('div');
|
||||
controllerContainer.setAttribute('class', 'guidat-controllers');
|
||||
|
||||
// Firefox hack for horizontal scrolling
|
||||
controllerContainer.addEventListener('DOMMouseScroll', function(e) {
|
||||
|
||||
var scrollAmount = this.scrollTop;
|
||||
|
||||
if (e.wheelDelta) {
|
||||
scrollAmount+=e.wheelDelta;
|
||||
} else if (e.detail) {
|
||||
scrollAmount+=e.detail;
|
||||
}
|
||||
|
||||
if (e.preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
e.returnValue = false;
|
||||
|
||||
controllerContainer.scrollTop = scrollAmount;
|
||||
|
||||
}, false);
|
||||
|
||||
controllerContainer.style.height = '0px';
|
||||
|
||||
var toggleButton = document.createElement('a');
|
||||
@ -117,7 +137,6 @@ var GUI = function() {
|
||||
|
||||
document.addEventListener('mouseup', function(e) {
|
||||
|
||||
|
||||
if (togglePressed && !toggleDragged) {
|
||||
|
||||
_this.toggle();
|
||||
@ -183,6 +202,7 @@ var GUI = function() {
|
||||
if(GUI.autoPlaceContainer == null) {
|
||||
GUI.autoPlaceContainer = document.createElement('div');
|
||||
GUI.autoPlaceContainer.setAttribute("id", "guidat");
|
||||
|
||||
document.body.appendChild(GUI.autoPlaceContainer);
|
||||
}
|
||||
GUI.autoPlaceContainer.appendChild(this.domElement);
|
||||
|
Loading…
Reference in New Issue
Block a user