From b88ebb47d82fc1ffebea49c3bf182aaf3c9419af Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 15:53:11 -0800 Subject: Fixed issue with elements not drawing in the correct plane. When first adding an element, force the 3d model to update with the element's webkit transform values. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 59 +++++++++++++-------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index f254220c..30469db0 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -127,36 +127,35 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, } else { - // TODO - for now, just return the identity matrix - return Matrix.I(4); -// var mat; -// -// if (elt) -// { -// var xformStr = ElementsMediator.getProperty(elt, "-webkit-transform"); -// if (xformStr) -// mat = this.transformStringToMat( xformStr ); -// if (!mat) -// mat = Matrix.I(4); -// -// if (elt.style && elt.style.zoom) -// { -// var zoom = Number(elt.style.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 ); -// } -// } -// } -// -// elt.elementModel.props3D.matrix3d = mat; -// return mat; + var mat; + + if (el) + { + var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); + if (xformStr) + mat = this.transformStringToMat( xformStr ); + 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