From 5a7f51d29ff28dc0d6d5032421eabaef0f5ff789 Mon Sep 17 00:00:00 2001 From: Tomas Date: Wed, 22 Apr 2020 10:58:03 +0200 Subject: [PATCH 1/3] Add dropdown documentation --- API.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/API.md b/API.md index 8d18170d..964bcc59 100644 --- a/API.md +++ b/API.md @@ -41,6 +41,7 @@ manipulate variables and fire functions on the fly. * [.load](#GUI+load) : Object * [.useLocalStorage](#GUI+useLocalStorage) : Boolean * [.add(object, property, [min], [max], [step])](#GUI+add) ⇒ [Controller](#Controller) + * [.add(object, property, values)](#GUI+add2) ⇒ [Controller](#Controller) * [.addColor(object, property)](#GUI+addColor) ⇒ [Controller](#Controller) * [.remove(controller)](#GUI+remove) * [.destroy()](#GUI+destroy) @@ -171,6 +172,27 @@ gui.add(person, 'name'); var person = {age: 45}; gui.add(person, 'age', 0, 100); ``` + + +### gui.add(object, property, values) ⇒ [Controller](#Controller) +Adds a new [Controller](#Controller) to the GUI. The type of controller created +is a `` dropdown. | --- | --- | --- | | object | Object | The object to be manipulated | | property | String | The name of the property to be manipulated | -| values | Array | Array of possible options' values | +| values | Array|Object | Array or Dictionary of possible options' values | **Example** ```js // Add a dropdown controller. var person = {name: 'Sam'}; -gui.add(person, 'name', ['Sam', 'Alex', 'Riley']); +gui.add(person, 'name', ['Sam', 'Alex', 'Ray']); +gui.add(person, 'name', {'Sam': 'Sammy', 'Alex': 'Alexis', 'Ray': 'Riley']); ``` From dcf0863d9c14e109d403bd68d522ea63a42dfd5b Mon Sep 17 00:00:00 2001 From: Tomas Date: Wed, 22 Apr 2020 11:03:00 +0200 Subject: [PATCH 3/3] Update API.md --- API.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API.md b/API.md index be4c93f5..b5377c48 100644 --- a/API.md +++ b/API.md @@ -192,7 +192,7 @@ is a `