mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Began gui.css
This commit is contained in:
parent
7c1fcb6cd8
commit
d140f6e02d
2
README
2
README
@ -1,2 +1,2 @@
|
||||
GUI-DAT is a controller library for JavaScript.
|
||||
Refer to [this gist](https://gist.github.com/792496) for basic usage.
|
||||
Refer to https://gist.github.com/792496 for basic usage.
|
||||
|
@ -1,5 +1,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<link href="gui.css" media="screen" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript" src="gui.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
20
gui.css
Normal file
20
gui.css
Normal file
@ -0,0 +1,20 @@
|
||||
#guidat {
|
||||
position: absolute;
|
||||
border: 1px solid red;
|
||||
width: 300px;
|
||||
z-index: 200;
|
||||
top: 0;
|
||||
left: 100%;
|
||||
margin-left: -320px;
|
||||
}
|
||||
|
||||
#guidat-controllers {
|
||||
height: 300px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#guidat-toggle {
|
||||
text-align: center;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
}
|
78
gui.js
78
gui.js
@ -1,34 +1,11 @@
|
||||
var GUI = new function() {
|
||||
|
||||
var _this = this;
|
||||
|
||||
// Contains list of properties we've add to the GUI in the following format:
|
||||
// [object, propertyName, controllerObject]
|
||||
var registeredProperties = [];
|
||||
|
||||
var domElement;
|
||||
var controllerContainer;
|
||||
var started = false;
|
||||
|
||||
this.start = function() {
|
||||
|
||||
domElement = document.createElement('div');
|
||||
domElement.setAttribute('id', 'guidat');
|
||||
|
||||
controllerContainer = document.createElement('div');
|
||||
controllerContainer.setAttribute('id', 'guidat-controllers');
|
||||
|
||||
toggleButton = document.createElement('a');
|
||||
toggleButton.setAttribute('id', 'guidat-toggle');
|
||||
toggleButton.innerHTML = "Show Controls";
|
||||
|
||||
|
||||
domElement.appendChild(controllerContainer);
|
||||
|
||||
|
||||
document.body.appendChild(domElement);
|
||||
|
||||
started = true;
|
||||
}
|
||||
|
||||
this.add = function() {
|
||||
|
||||
// We need to call GUI.start() before .add()
|
||||
@ -108,4 +85,55 @@ var GUI = new function() {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// GUI ... GUI
|
||||
|
||||
var domElement;
|
||||
var controllerContainer;
|
||||
var started = false;
|
||||
var open = false;
|
||||
|
||||
this.start = function() {
|
||||
|
||||
domElement = document.createElement('div');
|
||||
domElement.setAttribute('id', 'guidat');
|
||||
|
||||
controllerContainer = document.createElement('div');
|
||||
controllerContainer.setAttribute('id', 'guidat-controllers');
|
||||
|
||||
toggleButton = document.createElement('a');
|
||||
toggleButton.setAttribute('id', 'guidat-toggle');
|
||||
toggleButton.setAttribute('href', '#');
|
||||
toggleButton.innerHTML = "Show Controls";
|
||||
toggleButton.addEventListener('click', function(e) {
|
||||
_this.toggle();
|
||||
e.preventDefault();
|
||||
}, false);
|
||||
|
||||
domElement.appendChild(controllerContainer);
|
||||
domElement.appendChild(toggleButton);
|
||||
|
||||
document.body.appendChild(domElement);
|
||||
|
||||
started = true;
|
||||
|
||||
};
|
||||
|
||||
this.toggle = function() {
|
||||
|
||||
if (open) {
|
||||
|
||||
// Close the menu.
|
||||
open = false;
|
||||
|
||||
} else {
|
||||
|
||||
// Open the menu.
|
||||
open = true;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user