From 4774ed04a721877ad0f221a22302836b54d9f5b6 Mon Sep 17 00:00:00 2001 From: jonobr1 Date: Fri, 28 Jan 2011 19:19:30 -0700 Subject: [PATCH 1/9] removed README --- README | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index 1f8431a..0000000 --- a/README +++ /dev/null @@ -1,42 +0,0 @@ -# gui-dat -**gui-dat** is a lightweight controller library for JavaScript. It allows you to easily manipulate variables and fire functions on the fly. -## Basic Usage - - -+ ui-dat will infer the type of the property you're trying to add (based on its initial value) and create the corresponding control. -+ The properties must be public, i.e. defined by `**this**.prop = value`. -## Monitor variable changes outside of the GUI -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, "propName").listen(); -## Fire a function when someone uses a control - GUI.add(obj, "propName").onChange(function(n) { - alert("You changed me to " + n); - }); -Initiated by [George Michael Brower]:http://georgemichaelbrower.com/ and [Jono Brandel]:http://jonobr1.com/ of the Data Arts Team, Google Creative Lab. From e11bd9b98a718c9d69df24401629d93d21c87851 Mon Sep 17 00:00:00 2001 From: jonobr1 Date: Fri, 28 Jan 2011 19:55:43 -0700 Subject: [PATCH 2/9] Merged in mr doobs changes for watchers and changed setName to name --- controllers/controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/controller.js b/controllers/controller.js index ab9ae44..92c770f 100644 --- a/controllers/controller.js +++ b/controllers/controller.js @@ -4,7 +4,7 @@ var Controller = function() { this.parent = null; - this.setName = function(n) { + this.name = function(n) { this.propertyNameElement.innerHTML = n; return this; } @@ -57,7 +57,7 @@ var Controller = function() { this.propertyNameElement = document.createElement('span'); this.propertyNameElement.setAttribute('class', 'guidat-propertyname'); - this.setName(this.propertyName); + this.name(this.propertyName); this.domElement.appendChild(this.propertyNameElement); this.makeUnselectable(this.domElement); From 790083fa3b9958ce6b7badb70981cf152fd5c689 Mon Sep 17 00:00:00 2001 From: jonobr1 Date: Fri, 28 Jan 2011 20:03:56 -0700 Subject: [PATCH 3/9] why does README keep popping back up? --- README | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 README diff --git a/README b/README deleted file mode 100644 index 1f8431a..0000000 --- a/README +++ /dev/null @@ -1,42 +0,0 @@ -# gui-dat -**gui-dat** is a lightweight controller library for JavaScript. It allows you to easily manipulate variables and fire functions on the fly. -## Basic Usage - - -+ ui-dat will infer the type of the property you're trying to add (based on its initial value) and create the corresponding control. -+ The properties must be public, i.e. defined by `**this**.prop = value`. -## Monitor variable changes outside of the GUI -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, "propName").listen(); -## Fire a function when someone uses a control - GUI.add(obj, "propName").onChange(function(n) { - alert("You changed me to " + n); - }); -Initiated by [George Michael Brower]:http://georgemichaelbrower.com/ and [Jono Brandel]:http://jonobr1.com/ of the Data Arts Team, Google Creative Lab. From ebf5294ee5c5cff55091c9627461264ad43876b2 Mon Sep 17 00:00:00 2001 From: jonobr1 Date: Fri, 28 Jan 2011 20:17:57 -0700 Subject: [PATCH 4/9] updated index.html doc to reflect setWatched() --- index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.html b/index.html index 259cc21..245dd3d 100644 --- a/index.html +++ b/index.html @@ -93,6 +93,9 @@ window.onload = function() { // Boolean checkbox gui.add(fizzyText, "displayOutline"); + // Watches a property + gui.add(fizzyText, "framesRendered").setWatched(); + // Fires a function called "explode" gui.add(fizzyText, "explode").setName("Explode!"); // Specify a custom name. From d3effd0e8a322a4c96b137970d9a72a6b7f7f99d Mon Sep 17 00:00:00 2001 From: jonobr1 Date: Fri, 28 Jan 2011 20:22:05 -0700 Subject: [PATCH 5/9] updated index to reflect the new listen() and onChange() functionality --- controllers/controller.js | 2 +- index.html | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/controllers/controller.js b/controllers/controller.js index 92c770f..0fa37ff 100644 --- a/controllers/controller.js +++ b/controllers/controller.js @@ -9,7 +9,7 @@ var Controller = function() { return this; } - this.setWatched = function() { + this.listen = function() { this.parent.watchController(this); return this; } diff --git a/index.html b/index.html index 245dd3d..416e06a 100644 --- a/index.html +++ b/index.html @@ -46,7 +46,7 @@ gui.add(fizzyText, "displayOutline"); // Watches a property - gui.add(fizzyText, "framesRendered").setWatched(); + gui.add(fizzyText, "framesRendered").listen(); // Fires a function called "explode" gui.add(fizzyText, "explode").setName("Explode!"); // Specify a custom name. @@ -94,7 +94,7 @@ window.onload = function() { gui.add(fizzyText, "displayOutline"); // Watches a property - gui.add(fizzyText, "framesRendered").setWatched(); + gui.add(fizzyText, "framesRendered").listen(); // Fires a function called "explode" gui.add(fizzyText, "explode").setName("Explode!"); // Specify a custom name. @@ -108,7 +108,7 @@ window.onload = function() {
  • The properties must be public, i.e. defined by this.prop = value.
  • - +});