aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/element-controller.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/elements/element-controller.js')
-rwxr-xr-xjs/controllers/elements/element-controller.js94
1 files changed, 71 insertions, 23 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 53588f68..308e598b 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -5,7 +5,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component,
9 njModule = require("js/lib/NJUtils");
9 10
10exports.ElementController = Montage.create(Component, { 11exports.ElementController = Montage.create(Component, {
11 12
@@ -182,28 +183,12 @@ exports.ElementController = Montage.create(Component, {
182 el.elementModel.stroke = null; 183 el.elementModel.stroke = null;
183 return; 184 return;
184 case 'gradient': 185 case 'gradient':
185 if(color.borderInfo) {
186 if(color.borderInfo.borderWidth) {
187 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits);
188 }
189 if(color.borderInfo.borderStyle) {
190 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
191 }
192 }
193 this.setGradientBorder(el, color.color.gradientMode, color.color.css); 186 this.setGradientBorder(el, color.color.gradientMode, color.color.css);
194 break; 187 break;
195 default: 188 default:
196 this.setProperty(el, "border-image", "none"); 189 this.setProperty(el, "border-image", "none");
197 this.setProperty(el, "border-image-slice", ""); 190 this.setProperty(el, "border-image-slice", "");
198 this.setProperty(el, "border-color", color.color.css); 191 this.setProperty(el, "border-color", color.color.css);
199 if(color.borderInfo) {
200 if(color.borderInfo.borderWidth) {
201 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits);
202 }
203 if(color.borderInfo.borderStyle) {
204 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
205 }
206 }
207 } 192 }
208 } 193 }
209 el.elementModel.stroke = color; 194 el.elementModel.stroke = color;
@@ -231,20 +216,83 @@ exports.ElementController = Montage.create(Component, {
231 }, 216 },
232 217
233 getStroke: { 218 getStroke: {
234 value: function(el) { 219 value: function(el, stroke) {
235 // TODO - Need to figure out which border side user wants 220 var strokeInfo = {},
236 return this.application.ninja.stylesController.getElementStyle(el, "border"); 221 color,
222 borderWidth,
223 border;
224 if(stroke.colorInfo) {
225 strokeInfo.colorInfo = {};
226 color = this.getColor(el, false);
227 if(color && color.color) {
228 strokeInfo.colorInfo.mode = color.mode;
229 strokeInfo.colorInfo.color = color.color;
230 } else {
231 strokeInfo.colorInfo.mode = "nocolor";
232 strokeInfo.colorInfo.color = null;
233 }
234 }
235 if(stroke.borderInfo) {
236 // TODO - Need to figure out which border side user wants
237 strokeInfo.borderInfo = {};
238 if(stroke.borderInfo.borderWidth) {
239 borderWidth = this.getProperty(el, "border-width");
240 if(borderWidth) {
241 border = njModule.NJUtils.getValueAndUnits(borderWidth);
242 strokeInfo.borderInfo.borderWidth = border[0];
243 strokeInfo.borderInfo.borderUnits = border[1];
244 }
245 }
246 if(stroke.borderInfo.borderStyle) {
247 strokeInfo.borderInfo.borderStyle = this.getProperty(el, "border-style");
248 }
249 }
250 return strokeInfo;
237 } 251 }
238 }, 252 },
239 253
240 setStroke: { 254 setStroke: {
241 value: function(el, stroke) { 255 value: function(el, stroke) {
242 this.application.ninja.stylesController.setElementStyle(el, "border-width", stroke.borderWidth + stroke.borderUnits); 256 if(stroke.borderInfo) {
243 this.application.ninja.stylesController.setElementStyle(el, "border-style", stroke.borderStyle); 257 if(stroke.borderInfo.borderWidth) {
244 this.setColor(el, stroke.color, false); 258 this.application.ninja.stylesController.setElementStyle(el, "border-width", stroke.borderInfo.borderWidth + stroke.borderInfo.borderUnits);
259 }
260 if(stroke.borderInfo.borderStyle) {
261 this.application.ninja.stylesController.setElementStyle(el, "border-style", stroke.borderInfo.borderStyle);
262 }
263 }
264 if(stroke.colorInfo) {
265 this.setColor(el, stroke.colorInfo, false);
266 }
245 } 267 }
246 }, 268 },
247 269
270 getFill: {
271 value: function(el, fill) {
272 var fillInfo = {},
273 color;
274 if(fill.colorInfo) {
275 fillInfo.colorInfo = {};
276 color = this.getColor(el, true);
277 if(color && color.color) {
278 fillInfo.colorInfo.mode = color.mode;
279 fillInfo.colorInfo.color = color.color;
280 } else {
281 fillInfo.colorInfo.mode = "nocolor";
282 fillInfo.colorInfo.color = null;
283 }
284 }
285 return fillInfo;
286 }
287 },
288
289 setFill: {
290 value: function(el, fill) {
291 if(fill.colorInfo) {
292 this.setColor(el, fill.colorInfo, true);
293 }
294 }
295 },
248 //-------------------------------------------------------------------------------------------------------- 296 //--------------------------------------------------------------------------------------------------------
249 // Routines to get/set 3D properties 297 // Routines to get/set 3D properties
250 get3DProperty: { 298 get3DProperty: {