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.js26
1 files changed, 24 insertions, 2 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