aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorJonathan Duran2012-06-05 08:42:53 -0700
committerJonathan Duran2012-06-05 08:42:53 -0700
commitbd2c28100f347afc10243c80b8a288746370eee2 (patch)
treedb507fe0fdbe8e6f98f7d0f022b29c8d5942b4f7 /js/controllers/elements
parent121d0e616f48aa7cd048763554089c20a1883d7a (diff)
parentc1ec69879028220b0c3f11ad6e24035bf527802c (diff)
downloadninja-bd2c28100f347afc10243c80b8a288746370eee2.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Conflicts: js/controllers/elements/element-controller.js js/panels/Timeline/Layer.reel/Layer.js js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/element-controller.js26
-rwxr-xr-xjs/controllers/elements/shapes-controller.js4
2 files changed, 26 insertions, 4 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 675176e9..53588f68 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -11,6 +11,9 @@ exports.ElementController = Montage.create(Component, {
11 11
12 addElement: { 12 addElement: {
13 value: function(el, styles) { 13 value: function(el, styles) {
14
15 if (el.getAttribute) el.setAttribute('data-ninja-node', 'true');
16
14 // Updated to use new methods in TimelinePanel. JR. 17 // Updated to use new methods in TimelinePanel. JR.
15 var insertionIndex = this.application.ninja.timeline.getInsertionIndex(); 18 var insertionIndex = this.application.ninja.timeline.getInsertionIndex();
16 if (insertionIndex === false) { 19 if (insertionIndex === false) {
@@ -179,8 +182,6 @@ exports.ElementController = Montage.create(Component, {
179 el.elementModel.stroke = null; 182 el.elementModel.stroke = null;
180 return; 183 return;
181 case 'gradient': 184 case 'gradient':
182 this.setProperty(el, "border-image", color.color.css);
183 this.setProperty(el, "border-color", "none");
184 if(color.borderInfo) { 185 if(color.borderInfo) {
185 if(color.borderInfo.borderWidth) { 186 if(color.borderInfo.borderWidth) {
186 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); 187 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits);
@@ -189,9 +190,11 @@ exports.ElementController = Montage.create(Component, {
189 this.setProperty(el, "border-style", color.borderInfo.borderStyle); 190 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
190 } 191 }
191 } 192 }
193 this.setGradientBorder(el, color.color.gradientMode, color.color.css);
192 break; 194 break;
193 default: 195 default:
194 this.setProperty(el, "border-image", "none"); 196 this.setProperty(el, "border-image", "none");
197 this.setProperty(el, "border-image-slice", "");
195 this.setProperty(el, "border-color", color.color.css); 198 this.setProperty(el, "border-color", color.color.css);
196 if(color.borderInfo) { 199 if(color.borderInfo) {
197 if(color.borderInfo.borderWidth) { 200 if(color.borderInfo.borderWidth) {
@@ -208,6 +211,25 @@ exports.ElementController = Montage.create(Component, {
208 } 211 }
209 }, 212 },
210 213
214 setGradientBorder: {
215 value: function(el, gradientMode, css) {
216 if(gradientMode === "radial") {
217 this.setProperty(el, "border-image", css.replace("ellipse", "circle"));
218 } else {
219 this.setProperty(el, "border-image", css);
220 }
221 this.setProperty(el, "border-color", "none");
222 // gradient slice = borderWidth/totalWidth
223 var b = parseInt(this.getProperty(el, "border-left-width", true)),
224 w = parseInt(this.getProperty(el, "width", true)),
225 h = parseInt(this.getProperty(el, "height", true));
226 if(h > w) {
227 w = h;
228 }
229 this.setProperty(el, "border-image-slice", Math.floor(b/(w+b+b) * 100) + "%");
230 }
231 },
232
211 getStroke: { 233 getStroke: {
212 value: function(el) { 234 value: function(el) {
213 // TODO - Need to figure out which border side user wants 235 // TODO - Need to figure out which border side user wants
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 38f133b5..626dedb6 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -213,7 +213,7 @@ exports.ShapesController = Montage.create(CanvasController, {
213 default: 213 default:
214 CanvasController.setProperty(el, p, value); 214 CanvasController.setProperty(el, p, value);
215 } 215 }
216 this.application.ninja.documentController.activeDocument.model.needsSave = true; 216 this.application.ninja.currentDocument.model.needsSave = true;
217 } 217 }
218 }, 218 },
219 219
@@ -559,7 +559,7 @@ exports.ShapesController = Montage.create(CanvasController, {
559 } 559 }
560 } 560 }
561 el.elementModel.shapeModel.GLWorld.render(); 561 el.elementModel.shapeModel.GLWorld.render();
562 this.application.ninja.documentController.activeDocument.model.needsSave = true; 562 this.application.ninja.currentDocument.model.needsSave = true;
563 } 563 }
564 }, 564 },
565 565