diff options
author | Eric Guzman | 2012-04-11 11:03:09 -0700 |
---|---|---|
committer | Eric Guzman | 2012-04-11 11:03:09 -0700 |
commit | d203070579c8106b846657592a794ca8b4b1a9b6 (patch) | |
tree | a68566e581dbb96c5463031cb31131fbac8aa066 /js/controllers | |
parent | 435dde54bf607620947007f7c66bd98bd03fe90b (diff) | |
parent | 9d1c919a4865ab1a2b0b0b9fc893a54b145c82c0 (diff) | |
download | ninja-d203070579c8106b846657592a794ca8b4b1a9b6.tar.gz |
Merge branch 'refs/heads/master' into CSSPanelUpdates
Diffstat (limited to 'js/controllers')
-rwxr-xr-x | js/controllers/elements/element-controller.js | 10 | ||||
-rwxr-xr-x | js/controllers/elements/stage-controller.js | 20 | ||||
-rwxr-xr-x | js/controllers/styles-controller.js | 35 |
3 files changed, 42 insertions, 23 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index fda3a3c5..7ab6664f 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js | |||
@@ -249,10 +249,6 @@ exports.ElementController = Montage.create(Component, { | |||
249 | else | 249 | else |
250 | { | 250 | { |
251 | var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false); | 251 | var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, false); |
252 | if(dist == null) { | ||
253 | dist = 1400; | ||
254 | } | ||
255 | |||
256 | el.elementModel.props3D.perspectiveDist = dist; | 252 | el.elementModel.props3D.perspectiveDist = dist; |
257 | return dist; | 253 | return dist; |
258 | } | 254 | } |
@@ -266,9 +262,13 @@ exports.ElementController = Montage.create(Component, { | |||
266 | mat = props[index]["mat"]; | 262 | mat = props[index]["mat"]; |
267 | this.application.ninja.stylesController.setElementStyle(el, | 263 | this.application.ninja.stylesController.setElementStyle(el, |
268 | "-webkit-transform", | 264 | "-webkit-transform", |
269 | "perspective(" + dist + ") " + | ||
270 | "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); | 265 | "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); |
271 | 266 | ||
267 | // TODO - We don't support perspective on individual elements yet | ||
268 | // this.application.ninja.stylesController.setElementStyle(el, | ||
269 | // "-webkit-perspective", | ||
270 | // dist); | ||
271 | |||
272 | el.elementModel.props3D.matrix3d = mat; | 272 | el.elementModel.props3D.matrix3d = mat; |
273 | el.elementModel.props3D.perspectiveDist = dist; | 273 | el.elementModel.props3D.perspectiveDist = dist; |
274 | 274 | ||
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js index dc916b1a..f376e40f 100755 --- a/js/controllers/elements/stage-controller.js +++ b/js/controllers/elements/stage-controller.js | |||
@@ -90,7 +90,7 @@ exports.StageController = Montage.create(ElementController, { | |||
90 | return el.elementModel.stageView.style.getProperty(p); | 90 | return el.elementModel.stageView.style.getProperty(p); |
91 | } | 91 | } |
92 | default: | 92 | default: |
93 | return ElementController.getProperty(el, p, false, true); | 93 | return ElementController.getProperty(el, p, true, true); |
94 | //console.log("Undefined Stage property ", p); | 94 | //console.log("Undefined Stage property ", p); |
95 | } | 95 | } |
96 | } | 96 | } |
@@ -119,6 +119,7 @@ exports.StageController = Montage.create(ElementController, { | |||
119 | break; | 119 | break; |
120 | case "-webkit-transform-style": | 120 | case "-webkit-transform-style": |
121 | el.elementModel.stageView.style.setProperty(p, value); | 121 | el.elementModel.stageView.style.setProperty(p, value); |
122 | this.application.ninja.stage.updatedStage = true; | ||
122 | break; | 123 | break; |
123 | default: | 124 | default: |
124 | console.log("Undefined property ", p, "for the Stage Controller"); | 125 | console.log("Undefined property ", p, "for the Stage Controller"); |
@@ -178,5 +179,20 @@ exports.StageController = Montage.create(ElementController, { | |||
178 | return mat; | 179 | return mat; |
179 | } | 180 | } |
180 | } | 181 | } |
181 | } | 182 | }, |
183 | |||
184 | getPerspectiveDist: { | ||
185 | value: function(el) { | ||
186 | if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.perspectiveDist) | ||
187 | { | ||
188 | return el.elementModel.props3D.perspectiveDist; | ||
189 | } | ||
190 | else | ||
191 | { | ||
192 | var dist = this.application.ninja.stylesController.getPerspectiveDistFromElement(el, true); | ||
193 | el.elementModel.props3D.perspectiveDist = dist; | ||
194 | return dist; | ||
195 | } | ||
196 | } | ||
197 | }, | ||
182 | }); | 198 | }); |
diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 3e56f25c..f7c98023 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js | |||
@@ -1138,7 +1138,7 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1138 | 1138 | ||
1139 | getMatrixFromElement : { | 1139 | getMatrixFromElement : { |
1140 | value: function(element, isStage) { | 1140 | value: function(element, isStage) { |
1141 | var xformStr = this.getElementStyle(element, "-webkit-transform", false, isStage), | 1141 | var xformStr = this.getElementStyle(element, "-webkit-transform", true, isStage), |
1142 | mat; | 1142 | mat; |
1143 | 1143 | ||
1144 | if (xformStr) { | 1144 | if (xformStr) { |
@@ -1171,26 +1171,29 @@ var stylesController = exports.StylesController = Montage.create(Component, { | |||
1171 | 1171 | ||
1172 | getPerspectiveDistFromElement : { | 1172 | getPerspectiveDistFromElement : { |
1173 | value: function(element, isStage) { | 1173 | value: function(element, isStage) { |
1174 | var xformStr = this.getElementStyle(element, "-webkit-transform", false, isStage), | 1174 | var xformStr = this.getElementStyle(element, "-webkit-perspective", false, isStage), |
1175 | dist; | 1175 | dist; |
1176 | 1176 | ||
1177 | if (xformStr) { | 1177 | if(xformStr) { |
1178 | var index1 = xformStr.indexOf( "perspective("); | 1178 | dist = parseInt(xformStr); |
1179 | if (index1 >= 0) { | 1179 | } else { |
1180 | index1 += 12; // do not include 'perspective(' | 1180 | xformStr = this.getElementStyle(element, "-webkit-transform", true, isStage); |
1181 | var index2 = xformStr.indexOf( ")", index1 ); | 1181 | if (xformStr) { |
1182 | if (index2 >= 0) { | 1182 | var index1 = xformStr.indexOf( "perspective("); |
1183 | var substr = xformStr.substr( index1, (index2-index1)); | 1183 | if (index1 >= 0) { |
1184 | if (substr && (substr.length > 0)) { | 1184 | index1 += 12; // do not include 'perspective(' |
1185 | dist = parseInt( substr ); | 1185 | var index2 = xformStr.indexOf( ")", index1 ); |
1186 | if (index2 >= 0) { | ||
1187 | var substr = xformStr.substr( index1, (index2-index1)); | ||
1188 | if (substr && (substr.length > 0)) { | ||
1189 | dist = parseInt( substr ); | ||
1190 | } | ||
1186 | } | 1191 | } |
1187 | } | 1192 | } |
1188 | } | 1193 | } |
1189 | } else { | 1194 | } |
1190 | xformStr = this.getElementStyle(element, "-webkit-perspective", false, isStage); | 1195 | if(isNaN(dist)) { |
1191 | if(xformStr) { | 1196 | dist = null; |
1192 | dist = parseInt(xformStr); | ||
1193 | } | ||
1194 | } | 1197 | } |
1195 | return dist; | 1198 | return dist; |
1196 | } | 1199 | } |