diff --git a/demo/demo.css b/demo/demo.css index 9e5ce3d..b52bc5e 100644 --- a/demo/demo.css +++ b/demo/demo.css @@ -49,14 +49,14 @@ h2 { } h2.section { -margin: 0; -padding: 20px 0 20px; -cursor: pointer; -border-top: 1px dotted #ccc; --webkit-transition: color 0.15s linear; + margin: 0; + padding: 20px 0px 0px 0px; + cursor: pointer; + border-top: 1px dotted #ccc; + -webkit-transition: color 0.15s linear; } h2.section:hover { -color: #00aeff; + color: #00aeff; } div.collapsed h2, div.expanded h2 { @@ -67,6 +67,13 @@ div.collapsed h2, div.expanded h2 { cursor: pointer; } +div.trans { + border-top: 1px dotted #ccc; + margin: 0px 0px 20px 0px; +} +ol#secrets { + padding: 0px 0px 20px 0px; +} div.expanded h2:before { content: '-'; } @@ -83,16 +90,25 @@ div.expanded h2:before, div.collapsed h2:before { font-family: Monaco, monospace; } +div.collapsable { + overflow: hidden; + clear: both; + margin-bottom: 20px; + -moz-transition: height .2s ease-out; + -webkit-transition: height .2s ease-out; + transition: height .2s ease-out; +} + +div.collapsable div { + height: auto; +} + div.collapsed .collapsable { overflow: hidden; clear: both; height: 0; } -div.expanded .collapsable { - overflow: hidden; - clear: both; - height: auto; -} + div.expanded { cursor: pointer; } #helvetica-demo { diff --git a/gui.css b/gui.css index f05ca69..63f79be 100644 --- a/gui.css +++ b/gui.css @@ -100,7 +100,7 @@ a.guidat-toggle:hover { border: 0; color: #1ed36f; margin-right: 2px; -width: 148px; + width: 148px; } .guidat-controller.boolean { diff --git a/index.html b/index.html index 13ccbc5..3877700 100644 --- a/index.html +++ b/index.html @@ -62,10 +62,15 @@ function toggle(e) { - if(this.className == 'collapsed') { + var collapsable = this.childNodes[3], + wrapper = collapsable.childNodes[1]; + + if (this.className === 'collapsed') { this.className = 'expanded'; + collapsable.style.height = wrapper.clientHeight + 'px'; } else { this.className = 'collapsed'; + collapsable.style.height = '0px'; } } @@ -176,20 +181,22 @@ window.onload = function() {
The simplest way to save your parameters is via GUI.saveURL()
. This method directs your browser to a URL containing the current GUI settings.
++The simplest way to save your parameters is via
+GUI.saveURL()
. This method directs your browser to a URL containing the current GUI settings.// Make a button for the url function gui.add(GUI, "saveURL");- +
Let's say you'd like to share your settings with someone. Instead of sending a long link with lots of parameters stored in it, you can make your saved settings the defaults.
+Let's say you'd like to share your settings with someone. Instead of sending a long link with lots of parameters stored in it, you can make your saved settings the defaults.
-First, add the method GUI.showSaveString()
to a gui object:
var gui = new GUI(); +First, add the method
+GUI.showSaveString()
to a gui object:var gui = new GUI(); // Add some stuff (and pretend I change their values); gui.add(someObject, "someProperty"); @@ -198,8 +205,8 @@ gui.add(someObject, "someOtherProperty"); // Make a save button. gui.add(GUI, "showSaveString");-Clicking the "showSaveString" button bring up an alert with a string. Copy and paste that string into the method
-GUI.load()
before you instantiate any gui objects.+Clicking the "showSaveString" button bring up an alert with a string. Copy and paste that string into the method
+GUI.load()
before you instantiate any gui objects.// Replace COPIED STRING with the value you got from showSaveString() GUI.load("COPIED STRING"); @@ -209,33 +216,37 @@ var gui = new GUI(); gui.add(someObject, "someProperty"); gui.add(someObject, "someOtherProperty");-Save strings won't work if you change the order in which you've added properties to your gui objects, or the order of the gui objects themselves.. If you want to add more parameters to your gui and use an old save string, make sure they're added after the properties whose values you've saved.
-
Save strings won't work if you change the order in which you've added properties to your gui objects, or the order of the gui objects themselves.. If you want to add more parameters to your gui and use an old save string, make sure they're added after the properties whose values you've saved.
+Let's say you have a variable that changes by itself from time to time. If you'd like the GUI to reflect those changes, use the listen()
method.
gui.add(obj, "changingProperty").listen();-
Let's say you have a variable that changes by itself from time to time. If you'd like the GUI to reflect those changes, use the listen()
method.
gui.add(obj, "changingProperty").listen();+
By default, gui-dat will create an internal interval that checks for changes in the values you've marked with listen()
. If you'd like to check for these changes in an interval of your own definition, use the following:
++By default, gui-dat will create an internal interval that checks for changes in the values you've marked with
+listen()
. If you'd like to check for these changes in an interval of your own definition, use the following:gui.autoListen = false; // disables internal interval gui.add(obj, "changingProperty").listen(); // Make your own loop setInterval(function() { - gui.listen(); // updates values you've marked with listen() + gui.listen(); // updates values you've marked with listen() }, 1000 / 60);-Alternatively, you can forego calling
-listen()
on individual controllers, and instead choose to monitor changes in all values controlled by your gui.+Alternatively, you can forego calling
+listen()
on individual controllers, and instead choose to monitor changes in all values controlled by your gui.gui.autoListen = false; // disables internal interval gui.add(obj, "add"); gui.add(obj, "lotsa"); @@ -243,24 +254,26 @@ gui.add(obj, "properties"); // Make your own loop setInterval(function() { - gui.listenAll(); // updates ALL values managed by this gui + gui.listenAll(); // updates ALL values managed by this gui }, 1000 / 60);+
You can instantiate multiple GUI
objects and name them however you'd like.
var gui1 = new GUI(); ++You can instantiate multiple
+GUI
objects and name them however you'd like.var gui1 = new GUI(); var gui2 = new GUI(); // The name function overwrites the "Show Controls" text. gui1.name("Utilities"); gui2.name("Camera Placement");-By default, gui-dat panels will be automatically added to the HTML document and fixed to the top of the screen. You can disable this behavior / styling and append the gui DOM element to a container of your choosing.
-+By default, gui-dat panels will be automatically added to the HTML document and fixed to the top of the screen. You can disable this behavior / styling and append the gui DOM element to a container of your choosing.
+// Notice this belongs to the GUI class (uppercase) // and not an instance thereof. GUI.autoPlace = false; @@ -273,21 +286,26 @@ gui.domElement.style.top = "20px"; gui.domElement.style.left = "20px"; document.getElementById("my-gui-container").appendChild( gui.domElement );+