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;
|
top: 0;
|
||||||
left: 100%;
|
left: 100%;
|
||||||
margin-left: -320px;
|
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 {
|
#guidat-controllers {
|
||||||
|
12
gui.js
12
gui.js
@ -94,6 +94,9 @@ var GUI = new function() {
|
|||||||
var started = false;
|
var started = false;
|
||||||
var open = false;
|
var open = false;
|
||||||
|
|
||||||
|
// TODO: obtain this dynamically?
|
||||||
|
var domElementMarginTop = 301;
|
||||||
|
|
||||||
this.start = function() {
|
this.start = function() {
|
||||||
|
|
||||||
domElement = document.createElement('div');
|
domElement = document.createElement('div');
|
||||||
@ -114,6 +117,8 @@ var GUI = new function() {
|
|||||||
domElement.appendChild(controllerContainer);
|
domElement.appendChild(controllerContainer);
|
||||||
domElement.appendChild(toggleButton);
|
domElement.appendChild(toggleButton);
|
||||||
|
|
||||||
|
domElement.style.marginTop = -domElementMarginTop+"px";
|
||||||
|
|
||||||
document.body.appendChild(domElement);
|
document.body.appendChild(domElement);
|
||||||
|
|
||||||
started = true;
|
started = true;
|
||||||
@ -123,13 +128,14 @@ var GUI = new function() {
|
|||||||
this.toggle = function() {
|
this.toggle = function() {
|
||||||
|
|
||||||
if (open) {
|
if (open) {
|
||||||
|
domElement.style.marginTop = -domElementMarginTop+"px";
|
||||||
// Close the menu.
|
toggleButton.innerHTML = "Show Controls";
|
||||||
open = false;
|
open = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Open the menu.
|
domElement.style.marginTop = 0+"px";
|
||||||
|
toggleButton.innerHTML = "Hide Controls";
|
||||||
open = true;
|
open = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user