aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-01-31 17:30:53 -0800
committerNivesh Rajbhandari2012-01-31 17:30:53 -0800
commitaffafafc4db16e5f918c74dfc919025d4c563cc6 (patch)
treebae583f698d4993c52b31432b598bf4254f59bb0 /js/controllers/elements
parentff700e7921b8e30b89e963c48888c8296ed16f52 (diff)
downloadninja-affafafc4db16e5f918c74dfc919025d4c563cc6.tar.gz
Updated color code to handle shapes.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/controllers/elements')
-rw-r--r--js/controllers/elements/element-controller.js43
-rw-r--r--js/controllers/elements/shapes-controller.js2
2 files changed, 42 insertions, 3 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index f254220c..8a0735f7 100644
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -83,13 +83,52 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
83 83
84 setColor: { 84 setColor: {
85 value: function(el, color, isFill) { 85 value: function(el, color, isFill) {
86 var mode = color.mode;
86 if(isFill) 87 if(isFill)
87 { 88 {
88 this.application.ninja.stylesController.setElementStyle(el, "background-color", color.color.css); 89 if(mode)
90 {
91 switch (mode) {
92 case 'nocolor':
93 this.setProperty(el, "background-image", "none");
94 this.setProperty(el, "background-color", "none");
95 break;
96 case 'gradient':
97 this.setProperty(el, "background-image", color.color.css);
98 this.setProperty(el, "background-color", "none");
99 break;
100 default:
101 this.setProperty(el, "background-image", "none");
102 this.setProperty(el, "background-color", color.color.css);
103 }
104 }
105 else
106 {
107 this.application.ninja.stylesController.setElementStyle(el, "background-color", color.color.css);
108 }
89 } 109 }
90 else 110 else
91 { 111 {
92 this.application.ninja.stylesController.setElementStyle(el, "border-color", color.color.css); 112 if(mode)
113 {
114 switch (mode) {
115 case 'nocolor':
116 this.setProperty(el, "border-image", "none");
117 this.setProperty(el, "border-color", "none");
118 break;
119 case 'gradient':
120 this.setProperty(el, "border-image", color.color.css);
121 this.setProperty(el, "border-color", "none");
122 break;
123 default:
124 this.setProperty(el, "border-image", "none");
125 this.setProperty(el, "border-color", color.color.css);
126 }
127 }
128 else
129 {
130 this.application.ninja.stylesController.setElementStyle(el, "border-color", color.color.css);
131 }
93 } 132 }
94 } 133 }
95 }, 134 },
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index d34644a7..92353f28 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -168,7 +168,7 @@ exports.ShapesController = Montage.create(CanvasController, {
168 setColor: { 168 setColor: {
169 value: function(el, color, isFill) { 169 value: function(el, color, isFill) {
170 // TODO - Format color for webGL before setting 170 // TODO - Format color for webGL before setting
171 color = color.webGlColor; 171 color = color.webGlColor || color.color.webGlColor;
172 if(isFill) 172 if(isFill)
173 { 173 {
174 el.elementModel.shapeModel.GLGeomObj.setFillColor(color); 174 el.elementModel.shapeModel.GLGeomObj.setFillColor(color);