aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-03 10:58:03 -0700
committerValerio Virgillito2012-05-03 10:58:03 -0700
commitbe1806505f4af86c3b5c15454e67cb8cec696554 (patch)
tree137be320b75d29c295b332d381bd1851241887a6 /js/controllers/elements
parent30bf02869c93072cdb3a3a8b50cf943917f3b026 (diff)
parent691beb1c39fc0baa683f1fc56cbc519fe58f306d (diff)
downloadninja-be1806505f4af86c3b5c15454e67cb8cec696554.tar.gz
Merge branch 'refs/heads/master' into data-id
Diffstat (limited to 'js/controllers/elements')
-rwxr-xr-xjs/controllers/elements/body-controller.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index fbbb7c6e..14aeae24 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -12,6 +12,17 @@ exports.BodyController = Montage.create(ElementController, {
12 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat" 12 // TODO - perspective distance needs to be passed in as "dist" and matrix3d needs to be passed in as "mat"
13 set3DProperties: { 13 set3DProperties: {
14 value: function(el, props, update3DModel) { 14 value: function(el, props, update3DModel) {
15 var dist = props["dist"], mat = props["mat"];
16 this.application.ninja.stylesController.setElementStyle(el, "-webkit-transform", "perspective(" + dist + ") " + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")", true);
17
18 el.elementModel.props3D.matrix3d = mat;
19 el.elementModel.props3D.perspectiveDist = dist;
20
21 this.application.ninja.stage.updatedStage = true;
22
23 if(update3DModel) {
24 this._update3DProperties(el, mat, dist);
25 }
15 } 26 }
16 }, 27 },
17 28
@@ -40,5 +51,45 @@ exports.BodyController = Montage.create(ElementController, {
40 return dist; 51 return dist;
41 } 52 }
42 } 53 }
54 },
55
56 getMatrix: {
57 value: function(el) {
58 if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d)
59 {
60 return el.elementModel.props3D.matrix3d.slice(0);
61 }
62 else
63 {
64 var mat;
65
66 if (el)
67 {
68 mat = this.application.ninja.stylesController.getMatrixFromElement(el, true);
69 if (!mat) {
70 mat = Matrix.I(4);
71 }
72
73 var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom");
74 if (zoom)
75 {
76 zoom = Number(zoom);
77 if (zoom != 1)
78 {
79 var zoomMat = Matrix.create( [
80 [ zoom, 0, 0, 0],
81 [ 0, zoom, 0, 0],
82 [ 0, 0, zoom, 0],
83 [ 0, 0, 0, 1]
84 ] );
85 glmat4.multiply( zoomMat, mat, mat );
86 }
87 }
88 }
89
90 el.elementModel.props3D.matrix3d = mat;
91 return mat;
92 }
93 }
43 } 94 }
44}); 95});