aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorAnanya Sen2012-06-04 10:43:29 -0700
committerAnanya Sen2012-06-04 10:43:29 -0700
commit6fb29883329c9c42a8b406128b92c0e6323a47be (patch)
tree07f46e88bccf9cdb7d4e6818e1b646b0d19f05b9 /js/controllers/elements
parentcf097ec69e35c07ecae5a105ed5eeb78291c9ac2 (diff)
parentc1ec69879028220b0c3f11ad6e24035bf527802c (diff)
downloadninja-6fb29883329c9c42a8b406128b92c0e6323a47be.tar.gz
Merge branch 'refs/heads/ninja-internal-master' into cut-copy-paste
Conflicts: js/ninja.reel/ninja.html Signed-off-by: Ananya Sen <Ananya.Sen@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 20225c61..01e132d7 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 if(this.application.ninja.timeline.currentLayerSelected) { 17 if(this.application.ninja.timeline.currentLayerSelected) {
15 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID); 18 var selectedLayerIndex = this.application.ninja.timeline.getLayerIndexByID(this.application.ninja.timeline.currentLayerSelected.layerData.layerID);
16 19
@@ -159,8 +162,6 @@ exports.ElementController = Montage.create(Component, {
159 el.elementModel.stroke = null; 162 el.elementModel.stroke = null;
160 return; 163 return;
161 case 'gradient': 164 case 'gradient':
162 this.setProperty(el, "border-image", color.color.css);
163 this.setProperty(el, "border-color", "none");
164 if(color.borderInfo) { 165 if(color.borderInfo) {
165 if(color.borderInfo.borderWidth) { 166 if(color.borderInfo.borderWidth) {
166 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); 167 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits);
@@ -169,9 +170,11 @@ exports.ElementController = Montage.create(Component, {
169 this.setProperty(el, "border-style", color.borderInfo.borderStyle); 170 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
170 } 171 }
171 } 172 }
173 this.setGradientBorder(el, color.color.gradientMode, color.color.css);
172 break; 174 break;
173 default: 175 default:
174 this.setProperty(el, "border-image", "none"); 176 this.setProperty(el, "border-image", "none");
177 this.setProperty(el, "border-image-slice", "");
175 this.setProperty(el, "border-color", color.color.css); 178 this.setProperty(el, "border-color", color.color.css);
176 if(color.borderInfo) { 179 if(color.borderInfo) {
177 if(color.borderInfo.borderWidth) { 180 if(color.borderInfo.borderWidth) {
@@ -188,6 +191,25 @@ exports.ElementController = Montage.create(Component, {
188 } 191 }
189 }, 192 },
190 193
194 setGradientBorder: {
195 value: function(el, gradientMode, css) {
196 if(gradientMode === "radial") {
197 this.setProperty(el, "border-image", css.replace("ellipse", "circle"));
198 } else {
199 this.setProperty(el, "border-image", css);
200 }
201 this.setProperty(el, "border-color", "none");
202 // gradient slice = borderWidth/totalWidth
203 var b = parseInt(this.getProperty(el, "border-left-width", true)),
204 w = parseInt(this.getProperty(el, "width", true)),
205 h = parseInt(this.getProperty(el, "height", true));
206 if(h > w) {
207 w = h;
208 }
209 this.setProperty(el, "border-image-slice", Math.floor(b/(w+b+b) * 100) + "%");
210 }
211 },
212
191 getStroke: { 213 getStroke: {
192 value: function(el) { 214 value: function(el) {
193 // TODO - Need to figure out which border side user wants 215 // 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