aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-30 10:33:16 -0700
committerValerio Virgillito2012-05-30 10:33:16 -0700
commit0c2f181ca565f9c3b68fcfdc7124416e2e2fa647 (patch)
treef6d5300c528a69305abd30ffea1beee016241375 /js/controllers/elements
parent31b094ee21102f99a4021d505bc3a28527c9e23d (diff)
parentd4f2df2a7b3ec79fc54e17f09195dbc37331f051 (diff)
downloadninja-0c2f181ca565f9c3b68fcfdc7124416e2e2fa647.tar.gz
Merge branch 'Dom-Architecture' of github.com:mqg734/ninja-internal into document-bindings-fix
Conflicts: js/stage/stage-deps.js js/stage/stage.reel/stage.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/controllers/elements')
-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 20225c61..7bb07976 100755
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -159,8 +159,6 @@ exports.ElementController = Montage.create(Component, {
159 el.elementModel.stroke = null; 159 el.elementModel.stroke = null;
160 return; 160 return;
161 case 'gradient': 161 case 'gradient':
162 this.setProperty(el, "border-image", color.color.css);
163 this.setProperty(el, "border-color", "none");
164 if(color.borderInfo) { 162 if(color.borderInfo) {
165 if(color.borderInfo.borderWidth) { 163 if(color.borderInfo.borderWidth) {
166 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits); 164 this.setProperty(el, "border-width", color.borderInfo.borderWidth + color.borderInfo.borderUnits);
@@ -169,9 +167,11 @@ exports.ElementController = Montage.create(Component, {
169 this.setProperty(el, "border-style", color.borderInfo.borderStyle); 167 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
170 } 168 }
171 } 169 }
170 this.setGradientBorder(el, color.color.gradientMode, color.color.css);
172 break; 171 break;
173 default: 172 default:
174 this.setProperty(el, "border-image", "none"); 173 this.setProperty(el, "border-image", "none");
174 this.setProperty(el, "border-image-slice", "");
175 this.setProperty(el, "border-color", color.color.css); 175 this.setProperty(el, "border-color", color.color.css);
176 if(color.borderInfo) { 176 if(color.borderInfo) {
177 if(color.borderInfo.borderWidth) { 177 if(color.borderInfo.borderWidth) {
@@ -188,6 +188,25 @@ exports.ElementController = Montage.create(Component, {
188 } 188 }
189 }, 189 },
190 190
191 setGradientBorder: {
192 value: function(el, gradientMode, css) {
193 if(gradientMode === "radial") {
194 this.setProperty(el, "border-image", css.replace("ellipse", "circle"));
195 } else {
196 this.setProperty(el, "border-image", css);
197 }
198 this.setProperty(el, "border-color", "none");
199 // gradient slice = borderWidth/totalWidth
200 var b = parseInt(this.getProperty(el, "border-left-width", true)),
201 w = parseInt(this.getProperty(el, "width", true)),
202 h = parseInt(this.getProperty(el, "height", true));
203 if(h > w) {
204 w = h;
205 }
206 this.setProperty(el, "border-image-slice", Math.floor(b/(w+b+b) * 100) + "%");
207 }
208 },
209
191 getStroke: { 210 getStroke: {
192 value: function(el) { 211 value: function(el) {
193 // TODO - Need to figure out which border side user wants 212 // TODO - Need to figure out which border side user wants