Merge remote-tracking branch 'refs/remotes/dataarts/master'

This commit is contained in:
Andrej 2019-04-22 10:26:05 +07:00
commit b111f1c550
9 changed files with 52 additions and 12 deletions

16
API.md
View File

@ -48,6 +48,8 @@ manipulate variables and fire functions on the fly.
* [.removeFolder(folder)](#GUI+removeFolder) * [.removeFolder(folder)](#GUI+removeFolder)
* [.open()](#GUI+open) * [.open()](#GUI+open)
* [.close()](#GUI+close) * [.close()](#GUI+close)
* [.hide()](#GUI+hide)
* [.show()](#GUI+show)
* [.getRoot()](#GUI+getRoot) ⇒ <code>dat.gui.GUI</code> * [.getRoot()](#GUI+getRoot) ⇒ <code>dat.gui.GUI</code>
* [.getSaveObject()](#GUI+getSaveObject) ⇒ <code>Object</code> * [.getSaveObject()](#GUI+getSaveObject) ⇒ <code>Object</code>
@ -62,7 +64,7 @@ manipulate variables and fire functions on the fly.
| [params.load] | <code>Object</code> | | JSON object representing the saved state of this GUI. | | [params.load] | <code>Object</code> | | JSON object representing the saved state of this GUI. |
| [params.parent] | <code>dat.gui.GUI</code> | | The GUI I'm nested in. | | [params.parent] | <code>dat.gui.GUI</code> | | The GUI I'm nested in. |
| [params.autoPlace] | <code>Boolean</code> | <code>true</code> | | | [params.autoPlace] | <code>Boolean</code> | <code>true</code> | |
| [params.hideable] | <code>Boolean</code> | <code>true</code> | If true, GUI is closed by the <kbd>h</kbd> keypress. | | [params.hideable] | <code>Boolean</code> | <code>true</code> | If true, GUI is shown/hidden by <kbd>h</kbd> keypress. |
| [params.closed] | <code>Boolean</code> | <code>false</code> | If true, starts closed | | [params.closed] | <code>Boolean</code> | <code>false</code> | If true, starts closed |
| [params.closeOnTop] | <code>Boolean</code> | <code>false</code> | If true, close/open button shows on top of the GUI | | [params.closeOnTop] | <code>Boolean</code> | <code>false</code> | If true, close/open button shows on top of the GUI |
@ -252,6 +254,18 @@ Opens the GUI.
### gui.close() ### gui.close()
Closes the GUI. Closes the GUI.
**Kind**: instance method of [<code>GUI</code>](#GUI)
<a name="GUI+hide"></a>
### gui.hide()
Hides the GUI.
**Kind**: instance method of [<code>GUI</code>](#GUI)
<a name="GUI+show"></a>
### gui.show()
Shows the GUI.
**Kind**: instance method of [<code>GUI</code>](#GUI) **Kind**: instance method of [<code>GUI</code>](#GUI)
<a name="GUI+getRoot"></a> <a name="GUI+getRoot"></a>

View File

@ -1825,7 +1825,7 @@ var GUI = function GUI(pars) {
} }
}); });
if (Common.isUndefined(params.parent)) { if (Common.isUndefined(params.parent)) {
params.closed = false; this.closed = params.closed || false;
dom.addClass(this.domElement, GUI.CLASS_MAIN); dom.addClass(this.domElement, GUI.CLASS_MAIN);
dom.makeSelectable(this.domElement, false); dom.makeSelectable(this.domElement, false);
if (SUPPORTS_LOCAL_STORAGE) { if (SUPPORTS_LOCAL_STORAGE) {
@ -2013,6 +2013,12 @@ Common.extend(GUI.prototype,
close: function close() { close: function close() {
this.closed = true; this.closed = true;
}, },
hide: function hide() {
this.domElement.style.display = 'none';
},
show: function show() {
this.domElement.style.display = '';
},
onResize: function onResize() { onResize: function onResize() {
var root = this.getRoot(); var root = this.getRoot();
if (root.scrollable) { if (root.scrollable) {
@ -2203,7 +2209,7 @@ function augmentController(gui, li, controller) {
}); });
if (controller instanceof NumberControllerSlider) { if (controller instanceof NumberControllerSlider) {
var box = new NumberControllerBox(controller.object, controller.property, { min: controller.__min, max: controller.__max, step: controller.__step }); var box = new NumberControllerBox(controller.object, controller.property, { min: controller.__min, max: controller.__max, step: controller.__step });
Common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step'], function (method) { Common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function (method) {
var pc = controller[method]; var pc = controller[method];
var pb = box[method]; var pb = box[method];
controller[method] = box[method] = function () { controller[method] = box[method] = function () {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1819,7 +1819,7 @@ var GUI = function GUI(pars) {
} }
}); });
if (Common.isUndefined(params.parent)) { if (Common.isUndefined(params.parent)) {
params.closed = false; this.closed = params.closed || false;
dom.addClass(this.domElement, GUI.CLASS_MAIN); dom.addClass(this.domElement, GUI.CLASS_MAIN);
dom.makeSelectable(this.domElement, false); dom.makeSelectable(this.domElement, false);
if (SUPPORTS_LOCAL_STORAGE) { if (SUPPORTS_LOCAL_STORAGE) {
@ -2007,6 +2007,12 @@ Common.extend(GUI.prototype,
close: function close() { close: function close() {
this.closed = true; this.closed = true;
}, },
hide: function hide() {
this.domElement.style.display = 'none';
},
show: function show() {
this.domElement.style.display = '';
},
onResize: function onResize() { onResize: function onResize() {
var root = this.getRoot(); var root = this.getRoot();
if (root.scrollable) { if (root.scrollable) {
@ -2197,7 +2203,7 @@ function augmentController(gui, li, controller) {
}); });
if (controller instanceof NumberControllerSlider) { if (controller instanceof NumberControllerSlider) {
var box = new NumberControllerBox(controller.object, controller.property, { min: controller.__min, max: controller.__max, step: controller.__step }); var box = new NumberControllerBox(controller.object, controller.property, { min: controller.__min, max: controller.__max, step: controller.__step });
Common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step'], function (method) { Common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function (method) {
var pc = controller[method]; var pc = controller[method];
var pb = box[method]; var pb = box[method];
controller[method] = box[method] = function () { controller[method] = box[method] = function () {

File diff suppressed because one or more lines are too long

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "dat.gui", "name": "dat.gui",
"version": "0.7.3", "version": "0.7.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "dat.gui", "name": "dat.gui",
"version": "0.7.3", "version": "0.7.6",
"description": "A lightweight graphical user interface for changing variables in JavaScript.", "description": "A lightweight graphical user interface for changing variables in JavaScript.",
"main": "build/dat.gui.js", "main": "build/dat.gui.js",
"module": "build/dat.gui.module.js", "module": "build/dat.gui.module.js",

View File

@ -336,7 +336,7 @@ const GUI = function(pars) {
// Are we a root level GUI? // Are we a root level GUI?
if (common.isUndefined(params.parent)) { if (common.isUndefined(params.parent)) {
params.closed = false; this.closed = params.closed || false;
dom.addClass(this.domElement, GUI.CLASS_MAIN); dom.addClass(this.domElement, GUI.CLASS_MAIN);
dom.makeSelectable(this.domElement, false); dom.makeSelectable(this.domElement, false);
@ -684,6 +684,20 @@ common.extend(
this.closed = true; this.closed = true;
}, },
/**
* Hides the GUI.
*/
hide: function() {
this.domElement.style.display = 'none';
},
/**
* Shows the GUI.
*/
show: function() {
this.domElement.style.display = '';
},
onResize: function() { onResize: function() {
// we debounce this function to prevent performance issues when rotating on tablet/mobile // we debounce this function to prevent performance issues when rotating on tablet/mobile
@ -980,7 +994,7 @@ function augmentController(gui, li, controller) {
const box = new NumberControllerBox(controller.object, controller.property, const box = new NumberControllerBox(controller.object, controller.property,
{ min: controller.__min, max: controller.__max, step: controller.__step }); { min: controller.__min, max: controller.__max, step: controller.__step });
common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step'], function(method) { common.each(['updateDisplay', 'onChange', 'onFinishChange', 'step', 'min', 'max'], function(method) {
const pc = controller[method]; const pc = controller[method];
const pb = box[method]; const pb = box[method];
controller[method] = box[method] = function() { controller[method] = box[method] = function() {