mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Hide/show controls
This commit is contained in:
parent
d140f6e02d
commit
ba1ff6f492
3
gui.css
3
gui.css
@ -6,6 +6,9 @@ z-index: 200;
|
||||
top: 0;
|
||||
left: 100%;
|
||||
margin-left: -320px;
|
||||
-moz-transition: margin-top .2s ease-out;
|
||||
-webkit-transition: margin-top .2s ease-out;
|
||||
transition: margin-top .2s ease-out;
|
||||
}
|
||||
|
||||
#guidat-controllers {
|
||||
|
12
gui.js
12
gui.js
@ -94,6 +94,9 @@ var GUI = new function() {
|
||||
var started = false;
|
||||
var open = false;
|
||||
|
||||
// TODO: obtain this dynamically?
|
||||
var domElementMarginTop = 301;
|
||||
|
||||
this.start = function() {
|
||||
|
||||
domElement = document.createElement('div');
|
||||
@ -114,6 +117,8 @@ var GUI = new function() {
|
||||
domElement.appendChild(controllerContainer);
|
||||
domElement.appendChild(toggleButton);
|
||||
|
||||
domElement.style.marginTop = -domElementMarginTop+"px";
|
||||
|
||||
document.body.appendChild(domElement);
|
||||
|
||||
started = true;
|
||||
@ -123,13 +128,14 @@ var GUI = new function() {
|
||||
this.toggle = function() {
|
||||
|
||||
if (open) {
|
||||
|
||||
// Close the menu.
|
||||
domElement.style.marginTop = -domElementMarginTop+"px";
|
||||
toggleButton.innerHTML = "Show Controls";
|
||||
open = false;
|
||||
|
||||
} else {
|
||||
|
||||
// Open the menu.
|
||||
domElement.style.marginTop = 0+"px";
|
||||
toggleButton.innerHTML = "Hide Controls";
|
||||
open = true;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user