aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-22 22:26:51 -0700
committerValerio Virgillito2012-03-22 22:26:51 -0700
commit388d8e469e4641553b67aece4fc1d56d9789fff5 (patch)
treed5b75fc0cfb47a714ba240dabbd48def1c6993f4
parentf6afc520f357dec8daeb9b9e748f99c8d8508f7c (diff)
parentf2371c4a5a18a4dadb2e76f0275b90ac541e889d (diff)
downloadninja-388d8e469e4641553b67aece4fc1d56d9789fff5.tar.gz
Merge pull request #134 from mqg734/WebGL-Animation-CheckBox
Adding enabled/disabled support for PI"s checkbox controls, and using that capability for WebGL animate checkbox.
-rwxr-xr-xjs/components/checkbox.reel/checkbox.js21
-rwxr-xr-xjs/data/pi/pi-data.js9
-rwxr-xr-xjs/panels/properties.reel/sections/custom.reel/custom.js13
3 files changed, 40 insertions, 3 deletions
diff --git a/js/components/checkbox.reel/checkbox.js b/js/components/checkbox.reel/checkbox.js
index f06e5830..be331f4e 100755
--- a/js/components/checkbox.reel/checkbox.js
+++ b/js/components/checkbox.reel/checkbox.js
@@ -58,6 +58,26 @@ exports.Checkbox = Montage.create(Component, {
58 } 58 }
59 }, 59 },
60 60
61 _enabled: {
62 enumerable: false,
63 value: true
64 },
65
66 enabled: {
67 enumerable: true,
68 serializable: true,
69 get: function() {
70 return this._enabled;
71 },
72 set: function(value) {
73 if(value !== this._enabled)
74 {
75 this._enabled = value;
76 this.needsDraw = true;
77 }
78 }
79 },
80
61 handleChange: 81 handleChange:
62 { 82 {
63 value:function(event) 83 value:function(event)
@@ -76,6 +96,7 @@ exports.Checkbox = Montage.create(Component, {
76 96
77 draw: { 97 draw: {
78 value: function() { 98 value: function() {
99 this.element.disabled = !this._enabled;
79 if(!this._valueSyncedWithInputField) 100 if(!this._valueSyncedWithInputField)
80 { 101 {
81 this.element.checked = this._checked; 102 this.element.checked = this._checked;
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index 56337124..52360302 100755
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -398,7 +398,8 @@ exports.PiData = Montage.create( Montage, {
398 prop: "animate", 398 prop: "animate",
399 defaultValue: true, 399 defaultValue: true,
400 value: "Animate", 400 value: "Animate",
401 checked: true 401 checked: true,
402 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
402 } 403 }
403 ], 404 ],
404 [ 405 [
@@ -501,7 +502,8 @@ exports.PiData = Montage.create( Montage, {
501 prop: "animate", 502 prop: "animate",
502 defaultValue: true, 503 defaultValue: true,
503 value: "Animate", 504 value: "Animate",
504 checked: true 505 checked: true,
506 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
505 } 507 }
506 ], 508 ],
507 [ 509 [
@@ -605,7 +607,8 @@ exports.PiData = Montage.create( Montage, {
605 prop: "animate", 607 prop: "animate",
606 defaultValue: true, 608 defaultValue: true,
607 value: "Animate", 609 value: "Animate",
608 checked: true 610 checked: true,
611 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
609 } 612 }
610 ], 613 ],
611 [ 614 [
diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js
index 703ef950..ac316907 100755
--- a/js/panels/properties.reel/sections/custom.reel/custom.js
+++ b/js/panels/properties.reel/sections/custom.reel/custom.js
@@ -328,6 +328,19 @@ exports.CustomSection = Montage.create(Component, {
328 if (aField.value) obj.label = aField.value; 328 if (aField.value) obj.label = aField.value;
329 if (aField.prop) obj.prop = aField.prop; 329 if (aField.prop) obj.prop = aField.prop;
330 330
331 if (aField.enabled) {
332 if(aField.enabled.boundObject) {
333 // TODO - For now, always bind to this.controls[someProperty]
334 Object.defineBinding(obj, "enabled", {
335 boundObject: this.controls,
336 boundObjectPropertyPath: aField.enabled.boundProperty,
337 oneway: false
338 });
339 } else {
340 obj.enabled = aField.enabled;
341 }
342 }
343
331 //Initiate onChange Events 344 //Initiate onChange Events
332 obj.addEventListener("change", this, false); 345 obj.addEventListener("change", this, false);
333 346