aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorJonathan Duran2012-06-06 11:22:43 -0700
committerJonathan Duran2012-06-06 11:22:43 -0700
commit020a8147088f09547b7e84db2ada7c48f25c089f (patch)
tree5ec53061c4437d7a7cd8c983ef8a17aa6cfe0e19 /js/controllers/elements
parentb73cc6e348f3eb4cd57b5afeb7a6f5d3633b7e6b (diff)
parent18e212dca48066d1ddaca96875a3f40adcc859b6 (diff)
downloadninja-020a8147088f09547b7e84db2ada7c48f25c089f.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/component-controller.js4
-rwxr-xr-xjs/controllers/elements/element-controller.js94
-rwxr-xr-xjs/controllers/elements/shapes-controller.js101
3 files changed, 155 insertions, 44 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 5b0aaeac..dd0766df 100755
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -11,7 +11,7 @@ exports.ComponentController = Montage.create(ElementController, {
11 11
12 getProperty: { 12 getProperty: {
13 value: function(el, prop) { 13 value: function(el, prop) {
14 var component = el.controller || this.application.ninja.currentDocument.model.getComponentFromElement(el); 14 var component = el.controller;
15 15
16 switch(prop) { 16 switch(prop) {
17 case "id": 17 case "id":
@@ -34,7 +34,7 @@ exports.ComponentController = Montage.create(ElementController, {
34 34
35 setProperty: { 35 setProperty: {
36 value: function(el, p, value) { 36 value: function(el, p, value) {
37 var component = el.controller || this.application.ninja.currentDocument.model.getComponentFromElement(el); 37 var component = el.controller;
38 38
39 switch(p) { 39 switch(p) {
40 case "id": 40 case "id":
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: {
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 626dedb6..845e7dc2 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -551,12 +551,6 @@ exports.ShapesController = Montage.create(CanvasController, {
551 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 551 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
552 } 552 }
553 } 553 }
554
555 // Support for ink-bottle tool
556 if(color.strokeInfo)
557 {
558 this.setProperty(el, "strokeSize", color.strokeInfo.strokeSize + " " + color.strokeInfo.strokeUnits);
559 }
560 } 554 }
561 el.elementModel.shapeModel.GLWorld.render(); 555 el.elementModel.shapeModel.GLWorld.render();
562 this.application.ninja.currentDocument.model.needsSave = true; 556 this.application.ninja.currentDocument.model.needsSave = true;
@@ -564,23 +558,92 @@ exports.ShapesController = Montage.create(CanvasController, {
564 }, 558 },
565 559
566 getStroke: { 560 getStroke: {
567 value: function(el) { 561 value: function(el, stroke) {
568 // TODO - Need to figure out which border side user wants 562 var strokeInfo = {},
569 var size = this.getShapeProperty(el, "strokeSize"); 563 color,
570 var color = this.getShapeProperty(el, "stroke"); 564 strokeWidth,
571 return {stroke:color, strokeSize:size}; 565 strokeSize;
566 if(stroke.colorInfo) {
567 strokeInfo.colorInfo = {};
568 color = this.getColor(el, false);
569 if(color && color.color) {
570 strokeInfo.colorInfo.mode = color.mode;
571 strokeInfo.colorInfo.color = color.color;
572 } else {
573 strokeInfo.colorInfo.mode = "nocolor";
574 strokeInfo.colorInfo.color = null;
575 }
576 }