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.js23
1 files changed, 21 insertions, 2 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