From 52fac825174d16e3ff6875fc497d3f3cfaf4812c Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 21 Mar 2012 12:02:36 -0700 Subject: Get matrix and perspective distance from styles controller. Signed-off-by: Nivesh Rajbhandari --- js/models/properties-3d.js | 50 ++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 26 deletions(-) (limited to 'js/models/properties-3d.js') diff --git a/js/models/properties-3d.js b/js/models/properties-3d.js index 0f82dc48..087e794f 100755 --- a/js/models/properties-3d.js +++ b/js/models/properties-3d.js @@ -5,7 +5,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot */ var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; + Component = require("montage/ui/component").Component, + NJUtils = require("js/lib/NJUtils").NJUtils; exports.Properties3D = Montage.create(Component, { @@ -39,16 +40,7 @@ exports.Properties3D = Montage.create(Component, { elementPlane : { value : null, enumerable: true}, init : { - value : function(elt) { - - this.m_azimuth = 0.0; - this.m_altitude = 0.0; - - this.m_endAzimuth = 0.0; - this.m_endAltitude = 0.0; - - this.m_transformCtr = null; - this.perspectiveDist = 1400; + value : function(elt, isStage) { // this.m_upVector = [0,1,0]; // this.m_viewDir = [0,0,1]; @@ -57,23 +49,29 @@ exports.Properties3D = Montage.create(Component, { // this.m_targetPos = [0,0,0]; // this.m_objStartPos = [0,0,0]; -// var mat = this.application.ninja.stage.stageDeps.viewUtils.getMatrixFromElement(elt).slice(0); -// var elt3DInfo = MathUtils.decomposeMatrix2(mat); -// if(elt3DInfo) -// { -// this.xAngle = ~~(elt3DInfo.rotation[0] * MathUtils.RAD_TO_DEG); -// this.yAngle = ~~(elt3DInfo.rotation[1] * MathUtils.RAD_TO_DEG); -// this.zAngle = ~~(elt3DInfo.rotation[2] * MathUtils.RAD_TO_DEG); -// -// this.x3D = ~~(elt3DInfo.translation[0]); -// this.y3D = ~~(elt3DInfo.translation[1]); -// this.z3D = ~~(elt3DInfo.translation[2]); -// -// this.matrix3d = mat; -// } + this.matrix3d = this.application.ninja.stylesController.getMatrixFromElement(elt, isStage); + this.perspectiveDist = this.application.ninja.stylesController.getPerspectiveDistFromElement(elt, isStage); - return this; + if(this.matrix3d) { + var elt3DInfo = MathUtils.decomposeMatrix2(this.matrix3d); + if(elt3DInfo) { + this.xAngle = ~~(elt3DInfo.rotation[0] * MathUtils.RAD_TO_DEG); + this.yAngle = ~~(elt3DInfo.rotation[1] * MathUtils.RAD_TO_DEG); + this.zAngle = ~~(elt3DInfo.rotation[2] * MathUtils.RAD_TO_DEG); + this.x3D = ~~(elt3DInfo.translation[0]); + this.y3D = ~~(elt3DInfo.translation[1]); + this.z3D = ~~(elt3DInfo.translation[2]); + } + } else { + this.matrix3d = Matrix.I(4); + } + + if(this.perspectiveDist === null) { + this.perspectiveDist = 1400; + } + + return this; } }, -- cgit v1.2.3 From 62438ba52de51bb8ae20de07ec2f4dad55b9a929 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 27 Mar 2012 10:32:26 -0700 Subject: Build elements' properties3d values on file open. Signed-off-by: Nivesh Rajbhandari --- js/models/properties-3d.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/models/properties-3d.js') diff --git a/js/models/properties-3d.js b/js/models/properties-3d.js index 087e794f..0a7cf8bb 100755 --- a/js/models/properties-3d.js +++ b/js/models/properties-3d.js @@ -67,7 +67,7 @@ exports.Properties3D = Montage.create(Component, { this.matrix3d = Matrix.I(4); } - if(this.perspectiveDist === null) { + if(this.perspectiveDist == null) { this.perspectiveDist = 1400; } -- cgit v1.2.3