aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/element-controller.js23
-rwxr-xr-xjs/controllers/elements/shapes-controller.js4
2 files changed, 23 insertions, 4 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 8447c3d3..01e132d7 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -162,8 +162,6 @@ exports.ElementController = Montage.create(Component, {
162 el.elementModel.stroke = null; 162 el.elementModel.stroke = null;
163 return; 163 return;
164 case 'gradient': 164 case 'gradient':
165 this.setProperty(el, "border-image", color.color.css);
166 this.setProperty(el, "border-color", "none");
167 if(color.borderInfo) { 165 if(color.borderInfo) {
168 if(color.borderInfo.borderWidth) { 166 if(color.borderInfo.borderWidth) {
169 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); 167 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits);
@@ -172,9 +170,11 @@ exports.ElementController = Montage.create(Component, {
172 this.setProperty(el, "border-style", color.borderInfo.borderStyle); 170 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
173 } 171 }
174 } 172 }
173 this.setGradientBorder(el, color.color.gradientMode, color.color.css);
175 break; 174 break;
176 default: 175 default:
177 this.setProperty(el, "border-image", "none"); 176 this.setProperty(el, "border-image", "none");
177 this.setProperty(el, "border-image-slice", "");
178 this.setProperty(el, "border-color", color.color.css); 178 this.setProperty(el, "border-color", color.color.css);
179 if(color.borderInfo) { 179 if(color.borderInfo) {
180 if(color.borderInfo.borderWidth) { 180 if(color.borderInfo.borderWidth) {
@@ -191,6 +191,25 @@ exports.ElementController = Montage.create(Component, {
191 } 191 }
192 }, 192 },
193 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
194 getStroke: { 213 getStroke: {
195 value: function(el) { 214 value: function(el) {
196 // 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 d7012e23..e3eeca31 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