diff options
author | Jose Antonio Marquez Russo | 2012-01-31 17:40:17 -0800 |
---|---|---|
committer | Jose Antonio Marquez Russo | 2012-01-31 17:40:17 -0800 |
commit | 92ddcf89711c77453a55c4621afb469d61075e96 (patch) | |
tree | bae583f698d4993c52b31432b598bf4254f59bb0 /js/controllers/elements | |
parent | b125c02c3d2e28cc9364d16e23791cd6b540f17c (diff) | |
parent | affafafc4db16e5f918c74dfc919025d4c563cc6 (diff) | |
download | ninja-92ddcf89711c77453a55c4621afb469d61075e96.tar.gz |
Merge pull request #1 from mqg734/NiveshColor
Updated color code to handle shapes.
Diffstat (limited to 'js/controllers/elements')
-rw-r--r-- | js/controllers/elements/element-controller.js | 43 | ||||
-rw-r--r-- | js/controllers/elements/shapes-controller.js | 2 |
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); |