Hide/show controls

This commit is contained in:
George Michael Brower 2011-01-23 16:56:22 -07:00
parent d140f6e02d
commit ba1ff6f492
2 changed files with 12 additions and 3 deletions

View File

@ -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
View File

@ -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;
}