mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Merge branch 'master' into removefolder
This commit is contained in:
commit
1b7a6e2345
423
API.md
Normal file
423
API.md
Normal file
@ -0,0 +1,423 @@
|
|||||||
|
# dat.GUI API
|
||||||
|
|
||||||
|
Details about the classes, methods, and properties provided by dat.GUI. For more
|
||||||
|
hands-on examples, see the dat.GUI [tutorial](http://workshop.chromeexperiments.com/examples/gui).
|
||||||
|
|
||||||
|
<!--- API BEGIN --->
|
||||||
|
|
||||||
|
## Classes
|
||||||
|
|
||||||
|
<dl>
|
||||||
|
<dt><a href="#GUI">GUI</a></dt>
|
||||||
|
<dd><p>A lightweight controller library for JavaScript. It allows you to easily
|
||||||
|
manipulate variables and fire functions on the fly.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><a href="#Controller">Controller</a></dt>
|
||||||
|
<dd><p>An "abstract" class that represents a given property of an object.</p>
|
||||||
|
</dd>
|
||||||
|
<dt><a href="#NumberController">NumberController</a> ⇐ <code>dat.controllers.Controller</code></dt>
|
||||||
|
<dd><p>Represents a given property of an object that is a number.</p>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
|
||||||
|
<a name="GUI"></a>
|
||||||
|
|
||||||
|
## GUI
|
||||||
|
A lightweight controller library for JavaScript. It allows you to easily
|
||||||
|
manipulate variables and fire functions on the fly.
|
||||||
|
|
||||||
|
**Kind**: global class
|
||||||
|
|
||||||
|
* [GUI](#GUI)
|
||||||
|
* [new GUI([params])](#new_GUI_new)
|
||||||
|
* [.domElement](#GUI+domElement) : <code>DOMElement</code>
|
||||||
|
* [.parent](#GUI+parent) : <code>dat.gui.GUI</code>
|
||||||
|
* [.autoPlace](#GUI+autoPlace) : <code>Boolean</code>
|
||||||
|
* [.closeOnTop](#GUI+closeOnTop) : <code>Boolean</code>
|
||||||
|
* [.preset](#GUI+preset) : <code>String</code>
|
||||||
|
* [.width](#GUI+width) : <code>Number</code>
|
||||||
|
* [.name](#GUI+name) : <code>String</code>
|
||||||
|
* [.closed](#GUI+closed) : <code>Boolean</code>
|
||||||
|
* [.load](#GUI+load) : <code>Object</code>
|
||||||
|
* [.useLocalStorage](#GUI+useLocalStorage) : <code>Boolean</code>
|
||||||
|
* [.add(object, property, [min], [max], [step])](#GUI+add) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
* [.addColor(object, property)](#GUI+addColor) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
* [.remove(controller)](#GUI+remove)
|
||||||
|
* [.destroy()](#GUI+destroy)
|
||||||
|
* [.addFolder(name)](#GUI+addFolder) ⇒ <code>dat.gui.GUI</code>
|
||||||
|
* [.open()](#GUI+open)
|
||||||
|
* [.close()](#GUI+close)
|
||||||
|
* [.getRoot()](#GUI+getRoot) ⇒ <code>dat.gui.GUI</code>
|
||||||
|
* [.getSaveObject()](#GUI+getSaveObject) ⇒ <code>Object</code>
|
||||||
|
|
||||||
|
<a name="new_GUI_new"></a>
|
||||||
|
|
||||||
|
### new GUI([params])
|
||||||
|
|
||||||
|
| Param | Type | Default | Description |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| [params] | <code>Object</code> | | |
|
||||||
|
| [params.name] | <code>String</code> | | The name of this GUI. |
|
||||||
|
| [params.load] | <code>Object</code> | | JSON object representing the saved state of this GUI. |
|
||||||
|
| [params.auto] | <code>Boolean</code> | <code>true</code> | |
|
||||||
|
| [params.parent] | <code>dat.gui.GUI</code> | | The GUI I'm nested in. |
|
||||||
|
| [params.closed] | <code>Boolean</code> | | If true, starts closed |
|
||||||
|
| [params.closeOnTop] | <code>Boolean</code> | | If true, close/open button shows on top of the GUI |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Creating a GUI with options.
|
||||||
|
var gui = new dat.GUI({name: 'My GUI'});
|
||||||
|
```
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Creating a GUI and a subfolder.
|
||||||
|
var gui = new dat.GUI();
|
||||||
|
var folder1 = gui.addFolder('Flow Field');
|
||||||
|
```
|
||||||
|
<a name="GUI+domElement"></a>
|
||||||
|
|
||||||
|
### gui.domElement : <code>DOMElement</code>
|
||||||
|
Outermost DOM Element
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+parent"></a>
|
||||||
|
|
||||||
|
### gui.parent : <code>dat.gui.GUI</code>
|
||||||
|
The parent <code>GUI</code>
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+autoPlace"></a>
|
||||||
|
|
||||||
|
### gui.autoPlace : <code>Boolean</code>
|
||||||
|
Handles <code>GUI</code>'s element placement for you
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+closeOnTop"></a>
|
||||||
|
|
||||||
|
### gui.closeOnTop : <code>Boolean</code>
|
||||||
|
Handles <code>GUI</code>'s position of open/close button
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+preset"></a>
|
||||||
|
|
||||||
|
### gui.preset : <code>String</code>
|
||||||
|
The identifier for a set of saved values
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+width"></a>
|
||||||
|
|
||||||
|
### gui.width : <code>Number</code>
|
||||||
|
The width of <code>GUI</code> element
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+name"></a>
|
||||||
|
|
||||||
|
### gui.name : <code>String</code>
|
||||||
|
The name of <code>GUI</code>. Used for folders. i.e
|
||||||
|
a folder's name
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+closed"></a>
|
||||||
|
|
||||||
|
### gui.closed : <code>Boolean</code>
|
||||||
|
Whether the <code>GUI</code> is collapsed or not
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+load"></a>
|
||||||
|
|
||||||
|
### gui.load : <code>Object</code>
|
||||||
|
Contains all presets
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+useLocalStorage"></a>
|
||||||
|
|
||||||
|
### gui.useLocalStorage : <code>Boolean</code>
|
||||||
|
Determines whether or not to use <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage</a> as the means for
|
||||||
|
<code>remember</code>ing
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+add"></a>
|
||||||
|
|
||||||
|
### gui.add(object, property, [min], [max], [step]) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
Adds a new [Controller](#Controller) to the GUI. The type of controller created
|
||||||
|
is inferred from the initial value of <code>object[property]</code>. For
|
||||||
|
color properties, see [addColor](addColor).
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
**Returns**: [<code>Controller</code>](#Controller) - The controller that was added to the GUI.
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| object | <code>Object</code> | The object to be manipulated |
|
||||||
|
| property | <code>String</code> | The name of the property to be manipulated |
|
||||||
|
| [min] | <code>Number</code> | Minimum allowed value |
|
||||||
|
| [max] | <code>Number</code> | Maximum allowed value |
|
||||||
|
| [step] | <code>Number</code> | Increment by which to change value |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Add a string controller.
|
||||||
|
var person = {name: 'Sam'};
|
||||||
|
gui.add(person, 'name');
|
||||||
|
```
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
// Add a number controller slider.
|
||||||
|
var person = {age: 45};
|
||||||
|
gui.add(person, 'age', 0, 100);
|
||||||
|
```
|
||||||
|
<a name="GUI+addColor"></a>
|
||||||
|
|
||||||
|
### gui.addColor(object, property) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
Adds a new color controller to the GUI.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
**Returns**: [<code>Controller</code>](#Controller) - The controller that was added to the GUI.
|
||||||
|
|
||||||
|
| Param |
|
||||||
|
| --- |
|
||||||
|
| object |
|
||||||
|
| property |
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
```js
|
||||||
|
var palette = {
|
||||||
|
color1: '#FF0000', // CSS string
|
||||||
|
color2: [ 0, 128, 255 ], // RGB array
|
||||||
|
color3: [ 0, 128, 255, 0.3 ], // RGB with alpha
|
||||||
|
color4: { h: 350, s: 0.9, v: 0.3 } // Hue, saturation, value
|
||||||
|
};
|
||||||
|
gui.addColor(palette, 'color1');
|
||||||
|
gui.addColor(palette, 'color2');
|
||||||
|
gui.addColor(palette, 'color3');
|
||||||
|
gui.addColor(palette, 'color4');
|
||||||
|
```
|
||||||
|
<a name="GUI+remove"></a>
|
||||||
|
|
||||||
|
### gui.remove(controller)
|
||||||
|
Removes the given controller from the GUI.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
|
||||||
|
| Param | Type |
|
||||||
|
| --- | --- |
|
||||||
|
| controller | [<code>Controller</code>](#Controller) |
|
||||||
|
|
||||||
|
<a name="GUI+destroy"></a>
|
||||||
|
|
||||||
|
### gui.destroy()
|
||||||
|
Removes the GUI from the document and unbinds all event listeners.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+addFolder"></a>
|
||||||
|
|
||||||
|
### gui.addFolder(name) ⇒ <code>dat.gui.GUI</code>
|
||||||
|
Creates a new subfolder GUI instance.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
**Returns**: <code>dat.gui.GUI</code> - The new folder.
|
||||||
|
**Throws**:
|
||||||
|
|
||||||
|
- <code>Error</code> if this GUI already has a folder by the specified
|
||||||
|
name
|
||||||
|
|
||||||
|
|
||||||
|
| Param |
|
||||||
|
| --- |
|
||||||
|
| name |
|
||||||
|
|
||||||
|
<a name="GUI+open"></a>
|
||||||
|
|
||||||
|
### gui.open()
|
||||||
|
Opens the GUI.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+close"></a>
|
||||||
|
|
||||||
|
### gui.close()
|
||||||
|
Closes the GUI.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
<a name="GUI+getRoot"></a>
|
||||||
|
|
||||||
|
### gui.getRoot() ⇒ <code>dat.gui.GUI</code>
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
**Returns**: <code>dat.gui.GUI</code> - the topmost parent GUI of a nested GUI.
|
||||||
|
<a name="GUI+getSaveObject"></a>
|
||||||
|
|
||||||
|
### gui.getSaveObject() ⇒ <code>Object</code>
|
||||||
|
**Kind**: instance method of [<code>GUI</code>](#GUI)
|
||||||
|
**Returns**: <code>Object</code> - a JSON object representing the current state of
|
||||||
|
this GUI as well as its remembered properties.
|
||||||
|
<a name="Controller"></a>
|
||||||
|
|
||||||
|
## Controller
|
||||||
|
An "abstract" class that represents a given property of an object.
|
||||||
|
|
||||||
|
**Kind**: global class
|
||||||
|
|
||||||
|
* [Controller](#Controller)
|
||||||
|
* [new Controller(object, property)](#new_Controller_new)
|
||||||
|
* [.domElement](#Controller+domElement) : <code>DOMElement</code>
|
||||||
|
* [.object](#Controller+object) : <code>Object</code>
|
||||||
|
* [.property](#Controller+property) : <code>String</code>
|
||||||
|
* [.onChange(fnc)](#Controller+onChange) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
* [.onFinishChange(fnc)](#Controller+onFinishChange) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
* [.setValue(newValue)](#Controller+setValue)
|
||||||
|
* [.getValue()](#Controller+getValue) ⇒ <code>Object</code>
|
||||||
|
* [.updateDisplay()](#Controller+updateDisplay) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
* [.isModified()](#Controller+isModified) ⇒ <code>Boolean</code>
|
||||||
|
|
||||||
|
<a name="new_Controller_new"></a>
|
||||||
|
|
||||||
|
### new Controller(object, property)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| object | <code>Object</code> | The object to be manipulated |
|
||||||
|
| property | <code>string</code> | The name of the property to be manipulated |
|
||||||
|
|
||||||
|
<a name="Controller+domElement"></a>
|
||||||
|
|
||||||
|
### controller.domElement : <code>DOMElement</code>
|
||||||
|
Those who extend this class will put their DOM elements in here.
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>Controller</code>](#Controller)
|
||||||
|
<a name="Controller+object"></a>
|
||||||
|
|
||||||
|
### controller.object : <code>Object</code>
|
||||||
|
The object to manipulate
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>Controller</code>](#Controller)
|
||||||
|
<a name="Controller+property"></a>
|
||||||
|
|
||||||
|
### controller.property : <code>String</code>
|
||||||
|
The name of the property to manipulate
|
||||||
|
|
||||||
|
**Kind**: instance property of [<code>Controller</code>](#Controller)
|
||||||
|
<a name="Controller+onChange"></a>
|
||||||
|
|
||||||
|
### controller.onChange(fnc) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
Specify that a function fire every time someone changes the value with
|
||||||
|
this Controller.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>Controller</code>](#Controller)
|
||||||
|
**Returns**: [<code>Controller</code>](#Controller) - this
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| fnc | <code>function</code> | This function will be called whenever the value is modified via this Controller. |
|
||||||
|
|
||||||
|
<a name="Controller+onFinishChange"></a>
|
||||||
|
|
||||||
|
### controller.onFinishChange(fnc) ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
Specify that a function fire every time someone "finishes" changing
|
||||||
|
the value wih this Controller. Useful for values that change
|
||||||
|
incrementally like numbers or strings.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>Controller</code>](#Controller)
|
||||||
|
**Returns**: [<code>Controller</code>](#Controller) - this
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| fnc | <code>function</code> | This function will be called whenever someone "finishes" changing the value via this Controller. |
|
||||||
|
|
||||||
|
<a name="Controller+setValue"></a>
|
||||||
|
|
||||||
|
### controller.setValue(newValue)
|
||||||
|
Change the value of <code>object[property]</code>
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>Controller</code>](#Controller)
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| newValue | <code>Object</code> | The new value of <code>object[property]</code> |
|
||||||
|
|
||||||
|
<a name="Controller+getValue"></a>
|
||||||
|
|
||||||
|
### controller.getValue() ⇒ <code>Object</code>
|
||||||
|
Gets the value of <code>object[property]</code>
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>Controller</code>](#Controller)
|
||||||
|
**Returns**: <code>Object</code> - The current value of <code>object[property]</code>
|
||||||
|
<a name="Controller+updateDisplay"></a>
|
||||||
|
|
||||||
|
### controller.updateDisplay() ⇒ [<code>Controller</code>](#Controller)
|
||||||
|
Refreshes the visual display of a Controller in order to keep sync
|
||||||
|
with the object's current value.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>Controller</code>](#Controller)
|
||||||
|
**Returns**: [<code>Controller</code>](#Controller) - this
|
||||||
|
<a name="Controller+isModified"></a>
|
||||||
|
|
||||||
|
### controller.isModified() ⇒ <code>Boolean</code>
|
||||||
|
**Kind**: instance method of [<code>Controller</code>](#Controller)
|
||||||
|
**Returns**: <code>Boolean</code> - true if the value has deviated from initialValue
|
||||||
|
<a name="NumberController"></a>
|
||||||
|
|
||||||
|
## NumberController ⇐ <code>dat.controllers.Controller</code>
|
||||||
|
Represents a given property of an object that is a number.
|
||||||
|
|
||||||
|
**Kind**: global class
|
||||||
|
**Extends**: <code>dat.controllers.Controller</code>
|
||||||
|
|
||||||
|
* [NumberController](#NumberController) ⇐ <code>dat.controllers.Controller</code>
|
||||||
|
* [new NumberController(object, property, [params])](#new_NumberController_new)
|
||||||
|
* [.min(minValue)](#NumberController+min) ⇒ <code>dat.controllers.NumberController</code>
|
||||||
|
* [.max(maxValue)](#NumberController+max) ⇒ <code>dat.controllers.NumberController</code>
|
||||||
|
* [.step(stepValue)](#NumberController+step) ⇒ <code>dat.controllers.NumberController</code>
|
||||||
|
|
||||||
|
<a name="new_NumberController_new"></a>
|
||||||
|
|
||||||
|
### new NumberController(object, property, [params])
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| object | <code>Object</code> | The object to be manipulated |
|
||||||
|
| property | <code>string</code> | The name of the property to be manipulated |
|
||||||
|
| [params] | <code>Object</code> | Optional parameters |
|
||||||
|
| [params.min] | <code>Number</code> | Minimum allowed value |
|
||||||
|
| [params.max] | <code>Number</code> | Maximum allowed value |
|
||||||
|
| [params.step] | <code>Number</code> | Increment by which to change value |
|
||||||
|
|
||||||
|
<a name="NumberController+min"></a>
|
||||||
|
|
||||||
|
### numberController.min(minValue) ⇒ <code>dat.controllers.NumberController</code>
|
||||||
|
Specify a minimum value for <code>object[property]</code>.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>NumberController</code>](#NumberController)
|
||||||
|
**Returns**: <code>dat.controllers.NumberController</code> - this
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| minValue | <code>Number</code> | The minimum value for <code>object[property]</code> |
|
||||||
|
|
||||||
|
<a name="NumberController+max"></a>
|
||||||
|
|
||||||
|
### numberController.max(maxValue) ⇒ <code>dat.controllers.NumberController</code>
|
||||||
|
Specify a maximum value for <code>object[property]</code>.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>NumberController</code>](#NumberController)
|
||||||
|
**Returns**: <code>dat.controllers.NumberController</code> - this
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| maxValue | <code>Number</code> | The maximum value for <code>object[property]</code> |
|
||||||
|
|
||||||
|
<a name="NumberController+step"></a>
|
||||||
|
|
||||||
|
### numberController.step(stepValue) ⇒ <code>dat.controllers.NumberController</code>
|
||||||
|
Specify a step value that dat.controllers.NumberController
|
||||||
|
increments by.
|
||||||
|
|
||||||
|
**Kind**: instance method of [<code>NumberController</code>](#NumberController)
|
||||||
|
**Default**: <code>if minimum and maximum specified increment is 1% of the
|
||||||
|
difference otherwise stepValue is 1</code>
|
||||||
|
**Returns**: <code>dat.controllers.NumberController</code> - this
|
||||||
|
|
||||||
|
| Param | Type | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| stepValue | <code>Number</code> | The step value for dat.controllers.NumberController |
|
||||||
|
|
||||||
|
<!--- API END --->
|
@ -1,5 +1,11 @@
|
|||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 0.6.5
|
||||||
|
* Add browserify support. #137
|
||||||
|
|
||||||
|
### 0.6.4
|
||||||
|
* Fixed formatting issue on Windows. #136
|
||||||
|
* Fixed issue with color selector getting chopped off at bottom of gui. #136
|
||||||
|
|
||||||
### 0.6.3
|
### 0.6.3
|
||||||
* Added ability to put close button on top of the menu [ex: var gui = new dat.gui.GUI({closeOnTop:true})]. #106 #122
|
* Added ability to put close button on top of the menu [ex: var gui = new dat.gui.GUI({closeOnTop:true})]. #106 #122
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# dat.GUI
|
# dat.GUI
|
||||||
A lightweight graphical user interface for changing variables in JavaScript.
|
A lightweight graphical user interface for changing variables in JavaScript.
|
||||||
|
|
||||||
Get started with dat.GUI by reading the tutorial at http://workshop.chromeexperiments.com/examples/gui.
|
Get started with dat.GUI by reading the [tutorial](http://workshop.chromeexperiments.com/examples/gui)
|
||||||
|
or the [API documentation](API.md).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dat.gui",
|
"name": "dat.gui",
|
||||||
"version": "0.6.3",
|
"version": "0.6.5",
|
||||||
"homepage": "https://github.com/dataarts/dat.gui.git",
|
"homepage": "https://github.com/dataarts/dat.gui.git",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Google Data Arts Team <dataarts@google.com>"
|
"Google Data Arts Team <dataarts@google.com>"
|
||||||
|
@ -10,7 +10,8 @@
|
|||||||
/** Controller-half (right) */
|
/** Controller-half (right) */
|
||||||
/** Controller placement */
|
/** Controller placement */
|
||||||
/** Shorter number boxes when slider is present. */
|
/** Shorter number boxes when slider is present. */
|
||||||
/** Ensure the entire boolean and function row shows a hand */ }
|
/** Ensure the entire boolean and function row shows a hand */
|
||||||
|
/** allow overflow for color selector */ }
|
||||||
.dg ul {
|
.dg ul {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -66,7 +67,7 @@
|
|||||||
.dg.a {
|
.dg.a {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
overflow-x: hidden; }
|
overflow-y: visible; }
|
||||||
.dg.a.has-save > ul.close-top {
|
.dg.a.has-save > ul.close-top {
|
||||||
margin-top: 0; }
|
margin-top: 0; }
|
||||||
.dg.a.has-save > ul.close-bottom {
|
.dg.a.has-save > ul.close-bottom {
|
||||||
@ -93,7 +94,6 @@
|
|||||||
cursor: auto;
|
cursor: auto;
|
||||||
height: 27px;
|
height: 27px;
|
||||||
line-height: 27px;
|
line-height: 27px;
|
||||||
overflow: visible;
|
|
||||||
padding: 0 4px 0 5px; }
|
padding: 0 4px 0 5px; }
|
||||||
.dg li.folder {
|
.dg li.folder {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@ -110,7 +110,8 @@
|
|||||||
.dg .cr {
|
.dg .cr {
|
||||||
clear: both;
|
clear: both;
|
||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
height: 27px; }
|
height: 27px;
|
||||||
|
overflow: hidden; }
|
||||||
.dg .property-name {
|
.dg .property-name {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
float: left;
|
float: left;
|
||||||
@ -151,6 +152,8 @@
|
|||||||
.dg .cr.boolean,
|
.dg .cr.boolean,
|
||||||
.dg .cr.boolean * {
|
.dg .cr.boolean * {
|
||||||
cursor: pointer; }
|
cursor: pointer; }
|
||||||
|
.dg .cr.color {
|
||||||
|
overflow: visible; }
|
||||||
.dg .selector {
|
.dg .selector {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
build/dat.gui.min.js
vendored
4
build/dat.gui.min.js
vendored
File diff suppressed because one or more lines are too long
2
index.js
2
index.js
@ -13,4 +13,4 @@
|
|||||||
|
|
||||||
import dat from './src/dat/index';
|
import dat from './src/dat/index';
|
||||||
|
|
||||||
module.exports = dat;
|
export default dat;
|
||||||
|
46
package.json
46
package.json
@ -1,16 +1,41 @@
|
|||||||
{
|
{
|
||||||
"name": "dat.gui",
|
"name": "dat.gui",
|
||||||
"version": "0.6.3",
|
"version": "0.6.5",
|
||||||
"description": "A lightweight graphical user interface for changing variables in JavaScript.",
|
"description": "A lightweight graphical user interface for changing variables in JavaScript.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"test": "tests"
|
"test": "tests"
|
||||||
},
|
},
|
||||||
|
"browserify": {
|
||||||
|
"transform": [
|
||||||
|
[
|
||||||
|
"babelify",
|
||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
"es2015"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"stringify",
|
||||||
|
{
|
||||||
|
"extensions": [
|
||||||
|
".html"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"sassify"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack --progress --colors --watch --config webpack/webpack.config.js --devtool sourcemap",
|
"dev": "webpack --progress --colors --watch --config webpack/webpack.config.js --devtool sourcemap",
|
||||||
"build": "npm run build-js && npm run build-css",
|
"build": "npm run build-js && npm run build-css",
|
||||||
"build-js": "webpack --config ./webpack/webpack.config.js --devtool sourcemap && webpack --config ./webpack/webpack.config.min.js",
|
"build-js": "webpack --config ./webpack/webpack.config.js --devtool sourcemap && webpack --config ./webpack/webpack.config.min.js",
|
||||||
"build-css": "node-sass src/dat/gui/style.scss build/dat.gui.css"
|
"build-css": "node-sass src/dat/gui/style.scss build/dat.gui.css",
|
||||||
|
"build-docs": "jsdoc2md -f src/dat/gui/GUI.js src/dat/controllers/Controller.js src/dat/controllers/NumberController.js | replace-between --target API.md --token API",
|
||||||
|
"postversion": "git push && git push --tags && npm publish"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -25,7 +50,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.14.0",
|
"babel-core": "^6.14.0",
|
||||||
"babel-loader": "^6.2.5",
|
"babel-loader": "^6.2.5",
|
||||||
"babel-preset-es2015": "^6.14.0",
|
"babel-plugin-add-module-exports": "^0.2.1",
|
||||||
"babel-preset-stage-0": "^6.5.0",
|
"babel-preset-stage-0": "^6.5.0",
|
||||||
"css-loader": "^0.25.0",
|
"css-loader": "^0.25.0",
|
||||||
"eslint": "^3.5.0",
|
"eslint": "^3.5.0",
|
||||||
@ -34,17 +59,24 @@
|
|||||||
"eslint-plugin-import": "^1.15.0",
|
"eslint-plugin-import": "^1.15.0",
|
||||||
"extend": "^3.0.0",
|
"extend": "^3.0.0",
|
||||||
"html-loader": "^0.4.4",
|
"html-loader": "^0.4.4",
|
||||||
|
"jsdoc-to-markdown": "^3.0.2",
|
||||||
"node-sass": "^3.10.0",
|
"node-sass": "^3.10.0",
|
||||||
|
"replace-between": "0.0.8",
|
||||||
"sass-loader": "^4.0.2",
|
"sass-loader": "^4.0.2",
|
||||||
"webpack": "^1.13.2"
|
"webpack": "1.14.x"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"babel-preset-es2015": "^6.14.0",
|
||||||
|
"babelify": "^7.3.0",
|
||||||
|
"sassify": "^2.0.0",
|
||||||
|
"stringify": "^5.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {},
|
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "airbnb-base",
|
"extends": "airbnb-base",
|
||||||
"rules": {
|
"rules": {
|
||||||
"comma-dangle": 0,
|
"comma-dangle": 0,
|
||||||
"func-names": 0,
|
"func-names": 0,
|
||||||
"no-alert": 1,
|
"no-alert": 0,
|
||||||
"no-console": 1,
|
"no-console": 1,
|
||||||
"no-use-before-define": 0,
|
"no-use-before-define": 0,
|
||||||
"prefer-rest-params": 0,
|
"prefer-rest-params": 0,
|
||||||
@ -59,7 +91,7 @@
|
|||||||
"max-len": 0,
|
"max-len": 0,
|
||||||
"no-param-reassign": 0,
|
"no-param-reassign": 0,
|
||||||
"consistent-return": 0,
|
"consistent-return": 0,
|
||||||
"no-restricted-syntax": 1,
|
"no-restricted-syntax": 0,
|
||||||
"no-bitwise": 0,
|
"no-bitwise": 0,
|
||||||
"no-plusplus": 0
|
"no-plusplus": 0
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,11 @@ import dom from '../dom/dom';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @class Provides a checkbox input to alter the boolean property of an object.
|
* @class Provides a checkbox input to alter the boolean property of an object.
|
||||||
|
*
|
||||||
* @extends dat.controllers.Controller
|
* @extends dat.controllers.Controller
|
||||||
*
|
*
|
||||||
* @param {Object} object The object to be manipulated
|
* @param {Object} object The object to be manipulated
|
||||||
* @param {string} property The name of the property to be manipulated
|
* @param {string} property The name of the property to be manipulated
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class BooleanController extends Controller {
|
class BooleanController extends Controller {
|
||||||
constructor(object, property) {
|
constructor(object, property) {
|
||||||
|
@ -17,6 +17,11 @@ import Color from '../color/Color';
|
|||||||
import interpret from '../color/interpret';
|
import interpret from '../color/interpret';
|
||||||
import common from '../utils/common';
|
import common from '../utils/common';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Represents a given property of an object that is a color.
|
||||||
|
* @param {Object} object
|
||||||
|
* @param {string} property
|
||||||
|
*/
|
||||||
class ColorController extends Controller {
|
class ColorController extends Controller {
|
||||||
constructor(object, property) {
|
constructor(object, property) {
|
||||||
super(object, property);
|
super(object, property);
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
*
|
*
|
||||||
* @param {Object} object The object to be manipulated
|
* @param {Object} object The object to be manipulated
|
||||||
* @param {string} property The name of the property to be manipulated
|
* @param {string} property The name of the property to be manipulated
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class Controller {
|
class Controller {
|
||||||
constructor(object, property) {
|
constructor(object, property) {
|
||||||
|
@ -21,8 +21,6 @@ import dom from '../dom/dom';
|
|||||||
*
|
*
|
||||||
* @param {Object} object The object to be manipulated
|
* @param {Object} object The object to be manipulated
|
||||||
* @param {string} property The name of the property to be manipulated
|
* @param {string} property The name of the property to be manipulated
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class FunctionController extends Controller {
|
class FunctionController extends Controller {
|
||||||
constructor(object, property, text) {
|
constructor(object, property, text) {
|
||||||
|
@ -34,8 +34,6 @@ function numDecimals(x) {
|
|||||||
* @param {Number} [params.min] Minimum allowed value
|
* @param {Number} [params.min] Minimum allowed value
|
||||||
* @param {Number} [params.max] Maximum allowed value
|
* @param {Number} [params.max] Maximum allowed value
|
||||||
* @param {Number} [params.step] Increment by which to change value
|
* @param {Number} [params.step] Increment by which to change value
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class NumberController extends Controller {
|
class NumberController extends Controller {
|
||||||
constructor(object, property, params) {
|
constructor(object, property, params) {
|
||||||
@ -84,8 +82,8 @@ class NumberController extends Controller {
|
|||||||
* <code>object[property]</code>
|
* <code>object[property]</code>
|
||||||
* @returns {dat.controllers.NumberController} this
|
* @returns {dat.controllers.NumberController} this
|
||||||
*/
|
*/
|
||||||
min(v) {
|
min(minValue) {
|
||||||
this.__min = v;
|
this.__min = minValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,8 +94,8 @@ class NumberController extends Controller {
|
|||||||
* <code>object[property]</code>
|
* <code>object[property]</code>
|
||||||
* @returns {dat.controllers.NumberController} this
|
* @returns {dat.controllers.NumberController} this
|
||||||
*/
|
*/
|
||||||
max(v) {
|
max(maxValue) {
|
||||||
this.__max = v;
|
this.__max = maxValue;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,10 +109,10 @@ class NumberController extends Controller {
|
|||||||
* difference otherwise stepValue is 1
|
* difference otherwise stepValue is 1
|
||||||
* @returns {dat.controllers.NumberController} this
|
* @returns {dat.controllers.NumberController} this
|
||||||
*/
|
*/
|
||||||
step(v) {
|
step(stepValue) {
|
||||||
this.__step = v;
|
this.__step = stepValue;
|
||||||
this.__impliedStep = v;
|
this.__impliedStep = stepValue;
|
||||||
this.__precision = numDecimals(v);
|
this.__precision = numDecimals(stepValue);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,6 @@ function roundToDecimal(value, decimals) {
|
|||||||
* @param {Number} [params.min] Minimum allowed value
|
* @param {Number} [params.min] Minimum allowed value
|
||||||
* @param {Number} [params.max] Maximum allowed value
|
* @param {Number} [params.max] Maximum allowed value
|
||||||
* @param {Number} [params.step] Increment by which to change value
|
* @param {Number} [params.step] Increment by which to change value
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class NumberControllerBox extends NumberController {
|
class NumberControllerBox extends NumberController {
|
||||||
constructor(object, property, params) {
|
constructor(object, property, params) {
|
||||||
|
@ -33,8 +33,6 @@ function map(v, i1, i2, o1, o2) {
|
|||||||
* @param {Number} minValue Minimum allowed value
|
* @param {Number} minValue Minimum allowed value
|
||||||
* @param {Number} maxValue Maximum allowed value
|
* @param {Number} maxValue Maximum allowed value
|
||||||
* @param {Number} stepValue Increment by which to change value
|
* @param {Number} stepValue Increment by which to change value
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class NumberControllerSlider extends NumberController {
|
class NumberControllerSlider extends NumberController {
|
||||||
constructor(object, property, min, max, step) {
|
constructor(object, property, min, max, step) {
|
||||||
|
@ -25,8 +25,6 @@ import common from '../utils/common';
|
|||||||
* @param {string} property The name of the property to be manipulated
|
* @param {string} property The name of the property to be manipulated
|
||||||
* @param {Object|string[]} options A map of labels to acceptable values, or
|
* @param {Object|string[]} options A map of labels to acceptable values, or
|
||||||
* a list of acceptable string values.
|
* a list of acceptable string values.
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class OptionController extends Controller {
|
class OptionController extends Controller {
|
||||||
constructor(object, property, opts) {
|
constructor(object, property, opts) {
|
||||||
|
@ -21,8 +21,6 @@ import dom from '../dom/dom';
|
|||||||
*
|
*
|
||||||
* @param {Object} object The object to be manipulated
|
* @param {Object} object The object to be manipulated
|
||||||
* @param {string} property The name of the property to be manipulated
|
* @param {string} property The name of the property to be manipulated
|
||||||
*
|
|
||||||
* @member dat.controllers
|
|
||||||
*/
|
*/
|
||||||
class StringController extends Controller {
|
class StringController extends Controller {
|
||||||
constructor(object, property) {
|
constructor(object, property) {
|
||||||
|
@ -29,12 +29,12 @@ import styleSheet from './style.scss'; // CSS to embed in build
|
|||||||
|
|
||||||
css.inject(styleSheet);
|
css.inject(styleSheet);
|
||||||
|
|
||||||
/** Outer-most className for GUI's */
|
/** @ignore Outer-most className for GUI's */
|
||||||
const CSS_NAMESPACE = 'dg';
|
const CSS_NAMESPACE = 'dg';
|
||||||
|
|
||||||
const HIDE_KEY_CODE = 72;
|
const HIDE_KEY_CODE = 72;
|
||||||
|
|
||||||
/** The only value shared between the JS and SCSS. Use caution. */
|
/** @ignore The only value shared between the JS and SCSS. Use caution. */
|
||||||
const CLOSE_BUTTON_HEIGHT = 20;
|
const CLOSE_BUTTON_HEIGHT = 20;
|
||||||
|
|
||||||
const DEFAULT_DEFAULT_PRESET_NAME = 'Default';
|
const DEFAULT_DEFAULT_PRESET_NAME = 'Default';
|
||||||
@ -49,24 +49,32 @@ const SUPPORTS_LOCAL_STORAGE = (function() {
|
|||||||
|
|
||||||
let SAVE_DIALOGUE;
|
let SAVE_DIALOGUE;
|
||||||
|
|
||||||
/** Have we yet to create an autoPlace GUI? */
|
/** @ignore Have we yet to create an autoPlace GUI? */
|
||||||
let autoPlaceVirgin = true;
|
let autoPlaceVirgin = true;
|
||||||
|
|
||||||
/** Fixed position div that auto place GUI's go inside */
|
/** @ignore Fixed position div that auto place GUI's go inside */
|
||||||
let autoPlaceContainer;
|
let autoPlaceContainer;
|
||||||
|
|
||||||
/** Are we hiding the GUI's ? */
|
/** @ignore Are we hiding the GUI's ? */
|
||||||
let hide = false;
|
let hide = false;
|
||||||
|
|
||||||
/** GUI's which should be hidden */
|
/** @private GUI's which should be hidden */
|
||||||
const hideableGuis = [];
|
const hideableGuis = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A lightweight controller library for JavaScript. It allows you to easily
|
* @class A lightweight controller library for JavaScript. It allows you to easily
|
||||||
* manipulate variables and fire functions on the fly.
|
* manipulate variables and fire functions on the fly.
|
||||||
* @class
|
|
||||||
*
|
*
|
||||||
* @member dat.gui
|
* @typicalname gui
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Creating a GUI with options.
|
||||||
|
* var gui = new dat.GUI({name: 'My GUI'});
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Creating a GUI and a subfolder.
|
||||||
|
* var gui = new dat.GUI();
|
||||||
|
* var folder1 = gui.addFolder('Flow Field');
|
||||||
*
|
*
|
||||||
* @param {Object} [params]
|
* @param {Object} [params]
|
||||||
* @param {String} [params.name] The name of this GUI.
|
* @param {String} [params.name] The name of this GUI.
|
||||||
@ -84,7 +92,7 @@ const GUI = function(pars) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Outermost DOM Element
|
* Outermost DOM Element
|
||||||
* @type DOMElement
|
* @type {DOMElement}
|
||||||
*/
|
*/
|
||||||
this.domElement = document.createElement('div');
|
this.domElement = document.createElement('div');
|
||||||
this.__ul = document.createElement('ul');
|
this.__ul = document.createElement('ul');
|
||||||
@ -170,7 +178,7 @@ const GUI = function(pars) {
|
|||||||
let saveToLocalStorage;
|
let saveToLocalStorage;
|
||||||
|
|
||||||
Object.defineProperties(this,
|
Object.defineProperties(this,
|
||||||
/** @lends dat.gui.GUI.prototype */
|
/** @lends GUI.prototype */
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The parent <code>GUI</code>
|
* The parent <code>GUI</code>
|
||||||
@ -478,14 +486,31 @@ dom.bind(window, 'keydown', GUI._keydownHandler, false);
|
|||||||
common.extend(
|
common.extend(
|
||||||
GUI.prototype,
|
GUI.prototype,
|
||||||
|
|
||||||
/** @lends dat.gui.GUI */
|
/** @lends GUI.prototype */
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object
|
* Adds a new {@link Controller} to the GUI. The type of controller created
|
||||||
* @param property
|
* is inferred from the initial value of <code>object[property]</code>. For
|
||||||
* @returns {dat.controllers.Controller} The new controller that was added.
|
* color properties, see {@link addColor}.
|
||||||
|
*
|
||||||
|
* @param {Object} object The object to be manipulated
|
||||||
|
* @param {String} property The name of the property to be manipulated
|
||||||
|
* @param {Number} [min] Minimum allowed value
|
||||||
|
* @param {Number} [max] Maximum allowed value
|
||||||
|
* @param {Number} [step] Increment by which to change value
|
||||||
|
* @returns {Controller} The controller that was added to the GUI.
|
||||||
* @instance
|
* @instance
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Add a string controller.
|
||||||
|
* var person = {name: 'Sam'};
|
||||||
|
* gui.add(person, 'name');
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* // Add a number controller slider.
|
||||||
|
* var person = {age: 45};
|
||||||
|
* gui.add(person, 'age', 0, 100);
|
||||||
*/
|
*/
|
||||||
add: function(object, property) {
|
add: function(object, property) {
|
||||||
return add(
|
return add(
|
||||||
@ -499,10 +524,24 @@ common.extend(
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Adds a new color controller to the GUI.
|
||||||
|
*
|
||||||
* @param object
|
* @param object
|
||||||
* @param property
|
* @param property
|
||||||
* @returns {dat.controllers.ColorController} The new controller that was added.
|
* @returns {Controller} The controller that was added to the GUI.
|
||||||
* @instance
|
* @instance
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* var palette = {
|
||||||
|
* color1: '#FF0000', // CSS string
|
||||||
|
* color2: [ 0, 128, 255 ], // RGB array
|
||||||
|
* color3: [ 0, 128, 255, 0.3 ], // RGB with alpha
|
||||||
|
* color4: { h: 350, s: 0.9, v: 0.3 } // Hue, saturation, value
|
||||||
|
* };
|
||||||
|
* gui.addColor(palette, 'color1');
|
||||||
|
* gui.addColor(palette, 'color2');
|
||||||
|
* gui.addColor(palette, 'color3');
|
||||||
|
* gui.addColor(palette, 'color4');
|
||||||
*/
|
*/
|
||||||
addColor: function(object, property) {
|
addColor: function(object, property) {
|
||||||
return add(
|
return add(
|
||||||
@ -516,7 +555,8 @@ common.extend(
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param controller
|
* Removes the given controller from the GUI.
|
||||||
|
* @param {Controller} controller
|
||||||
* @instance
|
* @instance
|
||||||
*/
|
*/
|
||||||
remove: function(controller) {
|
remove: function(controller) {
|
||||||
@ -529,6 +569,10 @@ common.extend(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the GUI from the document and unbinds all event listeners.
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
destroy: function() {
|
destroy: function() {
|
||||||
if (this.autoPlace) {
|
if (this.autoPlace) {
|
||||||
autoPlaceContainer.removeChild(this.domElement);
|
autoPlaceContainer.removeChild(this.domElement);
|
||||||
@ -543,6 +587,7 @@ common.extend(
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Creates a new subfolder GUI instance.
|
||||||
* @param name
|
* @param name
|
||||||
* @returns {dat.gui.GUI} The new folder.
|
* @returns {dat.gui.GUI} The new folder.
|
||||||
* @throws {Error} if this GUI already has a folder by the specified
|
* @throws {Error} if this GUI already has a folder by the specified
|
||||||
@ -583,6 +628,11 @@ common.extend(
|
|||||||
return gui;
|
return gui;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes a subfolder GUI instance.
|
||||||
|
* {dat.gui.GUI} folder The folder to remove.
|
||||||
|
* @instance
|
||||||
|
*/
|
||||||
removeFolder: function(folder) {
|
removeFolder: function(folder) {
|
||||||
this.__ul.removeChild(folder.domElement.parentElement);
|
this.__ul.removeChild(folder.domElement.parentElement);
|
||||||
|
|
||||||
@ -601,10 +651,16 @@ common.extend(
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the GUI.
|
||||||
|
*/
|
||||||
open: function() {
|
open: function() {
|
||||||
this.closed = false;
|
this.closed = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the GUI.
|
||||||
|
*/
|
||||||
close: function() {
|
close: function() {
|
||||||
this.closed = true;
|
this.closed = true;
|
||||||
},
|
},
|
||||||
@ -650,9 +706,10 @@ common.extend(
|
|||||||
* the GUI grows. When remembering new objects, append them to the end
|
* the GUI grows. When remembering new objects, append them to the end
|
||||||
* of the list.
|
* of the list.
|
||||||
*
|
*
|
||||||
* @param {Object...} objects
|
* @param {...Object} objects
|
||||||
* @throws {Error} if not called on a top level GUI.
|
* @throws {Error} if not called on a top level GUI.
|
||||||
* @instance
|
* @instance
|
||||||
|
* @ignore
|
||||||
*/
|
*/
|
||||||
remember: function() {
|
remember: function() {
|
||||||
if (common.isUndefined(SAVE_DIALOGUE)) {
|
if (common.isUndefined(SAVE_DIALOGUE)) {
|
||||||
@ -793,6 +850,8 @@ common.extend(
|
|||||||
* @param gui
|
* @param gui
|
||||||
* @param [newDom] If specified, inserts the dom content in the new row
|
* @param [newDom] If specified, inserts the dom content in the new row
|
||||||
* @param [liBefore] If specified, places the new row before another row
|
* @param [liBefore] If specified, places the new row before another row
|
||||||
|
*
|
||||||
|
* @ignore
|
||||||
*/
|
*/
|
||||||
function addRow(gui, newDom, liBefore) {
|
function addRow(gui, newDom, liBefore) {
|
||||||
const li = document.createElement('li');
|
const li = document.createElement('li');
|
||||||
@ -1290,4 +1349,4 @@ function updateDisplays(controllerArray) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = GUI;
|
export default GUI;
|
||||||
|
@ -89,7 +89,7 @@ $button-height: 20px;
|
|||||||
|
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
overflow-x: hidden;
|
overflow-y:visible;
|
||||||
|
|
||||||
&.has-save > ul {
|
&.has-save > ul {
|
||||||
|
|
||||||
@ -130,7 +130,6 @@ $button-height: 20px;
|
|||||||
cursor: auto;
|
cursor: auto;
|
||||||
height: $row-height;
|
height: $row-height;
|
||||||
line-height: $row-height;
|
line-height: $row-height;
|
||||||
overflow: visible;
|
|
||||||
padding: 0 4px 0 5px;
|
padding: 0 4px 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,6 +159,7 @@ $button-height: 20px;
|
|||||||
clear: both;
|
clear: both;
|
||||||
padding-left: 3px;
|
padding-left: 3px;
|
||||||
height: $row-height;
|
height: $row-height;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Name-half (left) */
|
/** Name-half (left) */
|
||||||
@ -225,6 +225,11 @@ $button-height: 20px;
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** allow overflow for color selector */
|
||||||
|
.cr.color {
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
.selector {
|
.selector {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -37,7 +37,8 @@ module.exports = {
|
|||||||
loader: 'babel',
|
loader: 'babel',
|
||||||
exclude: /(node_modules|bower_components)/,
|
exclude: /(node_modules|bower_components)/,
|
||||||
query: {
|
query: {
|
||||||
presets: [["es2015", {"loose": true}], "stage-0"]
|
presets: [["es2015", {"loose": true}], "stage-0"],
|
||||||
|
plugins: ["add-module-exports"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user