mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Added Pro Tip 2
This commit is contained in:
parent
c189ae7f16
commit
ae5ccdd736
37
gui.js
37
gui.js
@ -451,8 +451,22 @@ var GUI = function() {
|
||||
|
||||
GUI.allGuis.push(this);
|
||||
|
||||
// Add hide listener if this is the first GUI.
|
||||
if (GUI.allGuis.length == 1) {
|
||||
window.addEventListener('keyup', function(e) {
|
||||
// Hide on "H"
|
||||
if (e.keyCode == 72) {
|
||||
GUI.toggleHide();
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Do not set this directly.
|
||||
GUI.hidden = false;
|
||||
|
||||
|
||||
// Static members
|
||||
|
||||
GUI.autoPlace = true;
|
||||
@ -460,6 +474,29 @@ GUI.autoPlaceContainer = null;
|
||||
GUI.allControllers = [];
|
||||
GUI.allGuis = [];
|
||||
|
||||
|
||||
GUI.toggleHide = function() {
|
||||
if (GUI.hidden) {
|
||||
GUI.show();
|
||||
} else {
|
||||
GUI.hide();
|
||||
}
|
||||
}
|
||||
|
||||
GUI.show = function() {
|
||||
GUI.hidden = false;
|
||||
for (var i in GUI.allGuis) {
|
||||
GUI.allGuis[i].domElement.style.display = "block";
|
||||
}
|
||||
}
|
||||
|
||||
GUI.hide = function() {
|
||||
GUI.hidden = true;
|
||||
for (var i in GUI.allGuis) {
|
||||
GUI.allGuis[i].domElement.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
GUI.saveURL = function() {
|
||||
var url = GUI.replaceGetVar("saveString", GUI.getSaveString());
|
||||
window.location = url;
|
||||
|
@ -319,7 +319,7 @@ document.getElementById("my-gui-container").appendChild( gui.domElement );</pre>
|
||||
<ol id="secrets">
|
||||
<li><strong>gui-dat</strong> panels are resizeable. Drag the show/hide button.</li>
|
||||
|
||||
<li>Pro tip #2 forthcoming.</li>
|
||||
<li>Press 'H' to show/hide GUI's.</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user