aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-28 17:19:42 -0800
committerNivesh Rajbhandari2012-02-28 17:19:42 -0800
commit209e0781e926212bbaaad9e8ca4b61a0c389b30f (patch)
tree322884e4f54aed9af2da96b30ddb87e7e51b19d1
parent7c9291a5bab4abd849547f8878f6fb962fc88250 (diff)
downloadninja-209e0781e926212bbaaad9e8ca4b61a0c389b30f.tar.gz
We need to remove color buttons from the color model when updating the PI for selection change.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/components/ui/color-chip.reel/color-chip.js15
-rwxr-xr-xjs/panels/properties/content.reel/content.js22
-rwxr-xr-xjs/panels/properties/sections/custom-rows/color-select.reel/color-select.html4
-rwxr-xr-xjs/panels/properties/sections/custom-rows/color-select.reel/color-select.js21
-rwxr-xr-xjs/panels/properties/sections/custom.reel/custom.js5
5 files changed, 66 insertions, 1 deletions
diff --git a/js/components/ui/color-chip.reel/color-chip.js b/js/components/ui/color-chip.reel/color-chip.js
index ed1ac27a..7a7411da 100755
--- a/js/components/ui/color-chip.reel/color-chip.js
+++ b/js/components/ui/color-chip.reel/color-chip.js
@@ -92,6 +92,21 @@ var ColorChip = exports.ColorChip = Montage.create(Component, {
92 this.changeDelegate(evt); 92 this.changeDelegate(evt);
93 } 93 }
94 } 94 }
95 },
96
97 destroy: {
98 value: function() {
99 this.application.ninja.colorController.removeButton(this.mode, this.chipBtn);
100 var mode = this.mode;
101 if(this.iconType) {
102 if(this.iconType === "fillIcon") {
103 mode = "fill";
104 } else if(this.iconType === "strokeIcon") {
105 mode = "stroke";
106 }
107 }
108 this.application.ninja.colorController.removeButton(mode, this.icon);
109 }
95 } 110 }
96 111
97}); 112});
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js
index 8fa33a75..58c37db4 100755
--- a/js/panels/properties/content.reel/content.js
+++ b/js/panels/properties/content.reel/content.js
@@ -156,6 +156,17 @@ exports.Content = Montage.create(Component, {
156 this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width")); 156 this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width"));
157 157
158 if(this.customPi !== stage.elementModel.pi) { 158 if(this.customPi !== stage.elementModel.pi) {
159 // We need to unregister color chips from the previous selection from the Color Model
160 var len = this.customSections.length;
161 for(var n = 0, controls; n < len; n++) {
162 controls = this.customSections[n].content.controls;
163 if(controls["colorSelect"]) {
164 controls["colorSelect"].destroy();
165 } else if(controls["stageBackground"]) {
166 controls["stageBackground"].destroy();
167 }
168 }
169
159 this.customPi = stage.elementModel.pi; 170 this.customPi = stage.elementModel.pi;
160 this.displayCustomProperties(stage, stage.elementModel.pi); 171 this.displayCustomProperties(stage, stage.elementModel.pi);
161 } 172 }
@@ -221,6 +232,17 @@ exports.Content = Montage.create(Component, {
221 232
222 // Custom Section 233 // Custom Section
223 if(this.customPi !== el.elementModel.pi) { 234 if(this.customPi !== el.elementModel.pi) {
235 // We need to unregister color chips from the previous selection from the Color Model
236 var len = this.customSections.length;
237 for(var n = 0, controls; n < len; n++) {
238 controls = this.customSections[n].content.controls;
239 if(controls["colorSelect"]) {
240 controls["colorSelect"].destroy();
241 } else if(controls["stageBackground"]) {
242 controls["stageBackground"].destroy();
243 }
244 }
245
224 this.customPi = el.elementModel.pi; 246 this.customPi = el.elementModel.pi;
225 this.displayCustomProperties(el, el.elementModel.pi); 247 this.displayCustomProperties(el, el.elementModel.pi);
226 } 248 }
diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html
index 9c2588b9..96cc4de7 100755
--- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html
+++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.html
@@ -14,7 +14,9 @@
14 "properties" : { 14 "properties" : {
15 "element" : {"#": "section"}, 15 "element" : {"#": "section"},
16 "Stroke" : {"#": "Stroke"}, 16 "Stroke" : {"#": "Stroke"},
17 "Fill" : {"#": "Fill"} 17 "Fill" : {"#": "Fill"},
18 "strokeChip" : {"@": "colorChip"},
19 "fillChip" : {"@": "colorChip2"}
18 } 20 }
19 }, 21 },
20 22
diff --git a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js
index 60f8efef..3e81ff67 100755
--- a/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js
+++ b/js/panels/properties/sections/custom-rows/color-select.reel/color-select.js
@@ -17,6 +17,14 @@ exports.ColorSelect = Montage.create(Component, {
17 value: null 17 value: null
18 }, 18 },
19 19
20 strokeChip: {
21 value: null
22 },
23
24 fillChip: {
25 value: null
26 },
27
20 handleChange: { 28 handleChange: {
21 value: function(e) { 29 value: function(e) {
22 30
@@ -57,6 +65,19 @@ exports.ColorSelect = Montage.create(Component, {
57// } 65// }
58 66
59 } 67 }
68 },
69
70 destroy: {
71 value: function() {
72 if(this.strokeChip)
73 {
74 this.strokeChip.destroy();
75 }
76 if(this.fillChip)
77 {
78 this.fillChip.destroy();
79 }
80 }
60 } 81 }
61 82
62}); \ No newline at end of file 83}); \ No newline at end of file
diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js
index a2b9b9fa..a537d323 100755
--- a/js/panels/properties/sections/custom.reel/custom.js
+++ b/js/panels/properties/sections/custom.reel/custom.js
@@ -59,6 +59,8 @@ exports.CustomSection = Montage.create(Component, {
59 if(obj1.visible === false) tmpRow.colorVisible = obj1.visible; 59 if(obj1.visible === false) tmpRow.colorVisible = obj1.visible;
60 if(obj2.visible === false) tmpRow.color2Visible = obj2.visible; 60 if(obj2.visible === false) tmpRow.color2Visible = obj2.visible;
61 61
62 // TODO - Hack for now to reference the color select object to unregister color chips
63 this.controls["colorSelect"] = tmpRow;
62 } 64 }
63 else 65 else
64 { 66 {
@@ -344,6 +346,9 @@ exports.CustomSection = Montage.create(Component, {
344 346
345 this.controls[aField.id] = obj; 347 this.controls[aField.id] = obj;
346 348
349 // TODO - Hack for now to reference the color select object to unregister color chips
350 this.controls["stageBackground"] = obj;
351
347 return obj; 352 return obj;
348 } 353 }
349 } 354 }