aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-06 14:03:40 -0800
committerNivesh Rajbhandari2012-02-06 14:18:58 -0800
commitf94b0c5ada403379b3ff8a900c2a2aabcecce49e (patch)
tree07d28ffb913e0a06e70d0792dcd1b2a87f7b7a83 /js
parent5737864d1d55d96e3cc3c1bc9b38ec58303b3981 (diff)
downloadninja-f94b0c5ada403379b3ff8a900c2a2aabcecce49e.tar.gz
Add enabled property for ComboBox to support enabling/disabling materials dropdowns in the PI.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js')
-rw-r--r--js/components/combobox.reel/combobox.js21
-rw-r--r--js/controllers/elements/shapes-controller.js5
-rw-r--r--js/data/pi/pi-data.js11
-rw-r--r--js/panels/properties/sections/custom.reel/custom.js12
4 files changed, 44 insertions, 5 deletions
diff --git a/js/components/combobox.reel/combobox.js b/js/components/combobox.reel/combobox.js
index a68a7d6b..deef2a47 100644
--- a/js/components/combobox.reel/combobox.js
+++ b/js/components/combobox.reel/combobox.js
@@ -76,6 +76,26 @@ exports.Combobox = Montage.create(Component, {
76 } 76 }
77 }, 77 },
78 78
79 _enabled: {
80 enumerable: false,
81 value: true
82 },
83
84 enabled: {
85 enumerable: true,
86 serializable: true,
87 get: function() {
88 return this._enabled;
89 },
90 set: function(value) {
91 if(value !== this._enabled)
92 {
93 this._enabled = value;
94 this.needsDraw = true;
95 }
96 }
97 },
98
79 handleChange: 99 handleChange:
80 { 100 {
81 value:function(event) 101 value:function(event)
@@ -117,6 +137,7 @@ exports.Combobox = Montage.create(Component, {
117 } 137 }
118 this.element.appendChild(optionItem); 138 this.element.appendChild(optionItem);
119 } 139 }
140 this.element.disabled = !this._enabled;
120 } 141 }
121 } 142 }
122 }, 143 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 22ba66b3..74c88084 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -57,8 +57,9 @@ exports.ShapesController = Montage.create(CanvasController, {
57 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 57 el.elementModel.shapeModel.GLGeomObj.buildBuffers();
58 break; 58 break;
59 case "useWebGl": 59 case "useWebGl":
60 this.toggleWebGlMode(el, value); 60// this.toggleWebGlMode(el, value);
61 el.elementModel.shapeModel.GLGeomObj.buildBuffers(); 61// el.elementModel.shapeModel.GLGeomObj.buildBuffers();
62 el.elementModel.shapeModel.useWebGl = value;
62 break; 63 break;
63 default: 64 default:
64 CanvasController.setProperty(el, p, value); 65 CanvasController.setProperty(el, p, value);
diff --git a/js/data/pi/pi-data.js b/js/data/pi/pi-data.js
index 8ccf17cc..901ca37f 100644
--- a/js/data/pi/pi-data.js
+++ b/js/data/pi/pi-data.js
@@ -385,6 +385,7 @@ exports.PiData = Montage.create( Montage, {
385 label: "Stroke", 385 label: "Stroke",
386 labelField: "_name", 386 labelField: "_name",
387 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 387 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
388 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" },
388 divider : true 389 divider : true
389 } 390 }
390 ], 391 ],
@@ -395,7 +396,8 @@ exports.PiData = Montage.create( Montage, {
395 prop: "fillMaterial", 396 prop: "fillMaterial",
396 label: "Fill", 397 label: "Fill",
397 labelField: "_name", 398 labelField: "_name",
398 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" } 399 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
400 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
399 } 401 }
400 ] 402 ]
401 ] 403 ]
@@ -458,7 +460,8 @@ exports.PiData = Montage.create( Montage, {
458 id: "stroke", 460 id: "stroke",
459 label: "Stroke", 461 label: "Stroke",
460 labelField: "_name", 462 labelField: "_name",
461 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" } 463 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
464 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
462 } 465 }
463 ] 466 ]
464 ] 467 ]
@@ -543,6 +546,7 @@ exports.PiData = Montage.create( Montage, {
543 label: "Stroke", 546 label: "Stroke",
544 labelFunction: function(item) { return item.getName(); }, 547 labelFunction: function(item) { return item.getName(); },
545 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" }, 548 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
549 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" },
546 divider : true 550 divider : true
547 } 551 }
548 ], 552 ],
@@ -553,7 +557,8 @@ exports.PiData = Montage.create( Montage, {
553 prop: "fillMaterial", 557 prop: "fillMaterial",
554 label: "Fill", 558 label: "Fill",
555 labelField: "_name", 559 labelField: "_name",
556 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" } 560 items : { boundObject: "this.application.ninja.appModel", boundProperty: "materials" },
561 enabled: { boundObject: "this.controls", boundProperty: "useWebGl" }
557 } 562 }
558 ] 563 ]
559 ] 564 ]
diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js
index 2b5b522a..e92a39fd 100644
--- a/js/panels/properties/sections/custom.reel/custom.js
+++ b/js/panels/properties/sections/custom.reel/custom.js
@@ -193,6 +193,18 @@ exports.CustomSection = Montage.create(Component, {
193 obj.items = aField.items; 193 obj.items = aField.items;
194 } 194 }
195 } 195 }
196 if (aField.enabled) {
197 if(aField.enabled.boundObject) {
198 // TODO - For now, always bind to this.controls[someProperty]
199 Object.defineBinding(obj, "enabled", {
200 boundObject: this.controls,
201 boundObjectPropertyPath: aField.enabled.boundProperty,
202 oneway: false
203 });
204 } else {
205 obj.enabled = aField.enabled;
206 }
207 }
196 208
197 obj.addEventListener("change", this, false); 209 obj.addEventListener("change", this, false);
198// 210//