From c534f70e9af920d252d0d94151c9d6f884283b81 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 1 May 2012 07:01:44 -0700 Subject: Get working plane grid to draw for new stage web template workflow. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/body-controller.js | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js index 839d0787..14aeae24 100755 --- a/js/controllers/elements/body-controller.js +++ b/js/controllers/elements/body-controller.js @@ -51,5 +51,45 @@ exports.BodyController = Montage.create(ElementController, { return dist; } } + }, + + getMatrix: { + value: function(el) { + if(el.elementModel && el.elementModel.props3D && el.elementModel.props3D.matrix3d) + { + return el.elementModel.props3D.matrix3d.slice(0); + } + else + { + var mat; + + if (el) + { + mat = this.application.ninja.stylesController.getMatrixFromElement(el, true); + if (!mat) { + mat = Matrix.I(4); + } + + var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); + if (zoom) + { + zoom = Number(zoom); + if (zoom != 1) + { + var zoomMat = Matrix.create( [ + [ zoom, 0, 0, 0], + [ 0, zoom, 0, 0], + [ 0, 0, zoom, 0], + [ 0, 0, 0, 1] + ] ); + glmat4.multiply( zoomMat, mat, mat ); + } + } + } + + el.elementModel.props3D.matrix3d = mat; + return mat; + } + } } }); -- cgit v1.2.3