aboutsummaryrefslogtreecommitdiff
path: root/js/models/properties-3d.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/models/properties-3d.js')
-rwxr-xr-xjs/models/properties-3d.js50
1 files changed, 24 insertions, 26 deletions
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
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component,
9 NJUtils = require("js/lib/NJUtils").NJUtils;
9 10
10exports.Properties3D = Montage.create(Component, { 11exports.Properties3D = Montage.create(Component, {
11 12
@@ -39,16 +40,7 @@ exports.Properties3D = Montage.create(Component, {
39 elementPlane : { value : null, enumerable: true}, 40 elementPlane : { value : null, enumerable: true},
40 41
41 init : { 42 init : {
42 value : function(elt) { 43 value : function(elt, isStage) {
43
44 this.m_azimuth = 0.0;
45 this.m_altitude = 0.0;
46
47 this.m_endAzimuth = 0.0;
48 this.m_endAltitude = 0.0;
49
50 this.m_transformCtr = null;
51 this.perspectiveDist = 1400;
52 44
53// this.m_upVector = [0,1,0]; 45// this.m_upVector = [0,1,0];
54// this.m_viewDir = [0,0,1]; 46// this.m_viewDir = [0,0,1];
@@ -57,23 +49,29 @@ exports.Properties3D = Montage.create(Component, {
57// this.m_targetPos = [0,0,0]; 49// this.m_targetPos = [0,0,0];
58// this.m_objStartPos = [0,0,0]; 50// this.m_objStartPos = [0,0,0];
59 51
60// var mat = this.application.ninja.stage.stageDeps.viewUtils.getMatrixFromElement(elt).slice(0); 52 this.matrix3d = this.application.ninja.stylesController.getMatrixFromElement(elt, isStage);
61// var elt3DInfo = MathUtils.decomposeMatrix2(mat); 53 this.perspectiveDist = this.application.ninja.stylesController.getPerspectiveDistFromElement(elt, isStage);
62// if(elt3DInfo)
63// {
64// this.xAngle = ~~(elt3DInfo.rotation[0] * MathUtils.RAD_TO_DEG);
65// this.yAngle = ~~(elt3DInfo.rotation[1] * MathUtils.RAD_TO_DEG);
66// this.zAngle = ~~(elt3DInfo.rotation[2] * MathUtils.RAD_TO_DEG);
67//
68// this.x3D = ~~(elt3DInfo.translation[0]);
69// this.y3D = ~~(elt3DInfo.translation[1]);
70// this.z3D = ~~(elt3DInfo.translation[2]);
71//
72// this.matrix3d = mat;
73// }
74 54
75 return this; 55 if(this.matrix3d) {
56 var elt3DInfo = MathUtils.decomposeMatrix2(this.matrix3d);
57 if(elt3DInfo) {
58 this.xAngle = ~~(elt3DInfo.rotation[0] * MathUtils.RAD_TO_DEG);
59 this.yAngle = ~~(elt3DInfo.rotation[1] * MathUtils.RAD_TO_DEG);
60 this.zAngle = ~~(elt3DInfo.rotation[2] * MathUtils.RAD_TO_DEG);
76 61
62 this.x3D = ~~(elt3DInfo.translation[0]);
63 this.y3D = ~~(elt3DInfo.translation[1]);
64 this.z3D = ~~(elt3DInfo.translation[2]);
65 }
66 } else {
67 this.matrix3d = Matrix.I(4);
68 }
69
70 if(this.perspectiveDist === null) {
71 this.perspectiveDist = 1400;
72 }
73
74 return this;
77 } 75 }
78 }, 76 },
79 77