diff options
author | hwc487 | 2012-04-13 13:48:07 -0700 |
---|---|---|
committer | hwc487 | 2012-04-13 13:48:07 -0700 |
commit | 642d7b45446894a2f3038dcc07a867b260968256 (patch) | |
tree | c3d7d4e205dccaab6f0e2b02bd223eaf83c79a3f /js/tools/Rotate3DToolBase.js | |
parent | 4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c (diff) | |
download | ninja-642d7b45446894a2f3038dcc07a867b260968256.tar.gz |
3D rotation
Diffstat (limited to 'js/tools/Rotate3DToolBase.js')
-rwxr-xr-x | js/tools/Rotate3DToolBase.js | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/js/tools/Rotate3DToolBase.js b/js/tools/Rotate3DToolBase.js index e65dc842..880eefc4 100755 --- a/js/tools/Rotate3DToolBase.js +++ b/js/tools/Rotate3DToolBase.js | |||
@@ -54,22 +54,19 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { | |||
54 | { | 54 | { |
55 | if(this._activateOriginHandle) | 55 | if(this._activateOriginHandle) |
56 | { | 56 | { |
57 | // move the transform origin handle | 57 | // move the transform origin handle directly to the snap point (pt1) |
58 | var dx = pt1.x - pt0.x; | 58 | this._origin[0] = pt1.x; |
59 | var dy = pt1.y - pt0.y; | 59 | this._origin[1] = pt1.y; |
60 | var dz = pt1.z - pt0.z; | 60 | this._origin[2] = pt1.z; |
61 | 61 | ||
62 | this._origin[0] += dx; | 62 | var sw2gMat = viewUtils.getStageWorldToGlobalMatrix(); |
63 | this._origin[1] += dy; | 63 | var g2swMat = glmat4.inverse( sw2gMat, [] ); |
64 | this._origin[2] += dz; | 64 | var swOrigin = MathUtils.transformAndDivideHomogeneousPoint( this._origin, g2swMat ); |
65 | console.log( "modifyElements, _origin: " + this._origin ); | 65 | //console.log( "modifyElements, _origin: " + this._origin + ", in stageWorld: " + swOrigin ); |
66 | 66 | ||
67 | var len = this._targets.length; | 67 | var len = this._targets.length; |
68 | if(len === 1) | 68 | if(len === 1) |
69 | { | 69 | { |
70 | // this._startOriginArray[0][0] += dx; | ||
71 | // this._startOriginArray[0][1] += dy; | ||
72 | // this._startOriginArray[0][2] += dz; | ||
73 | var g2lMat = this._targets[0].g2l; | 70 | var g2lMat = this._targets[0].g2l; |
74 | var localOrigin = MathUtils.transformAndDivideHomogeneousPoint( this._origin, g2lMat ); | 71 | var localOrigin = MathUtils.transformAndDivideHomogeneousPoint( this._origin, g2lMat ); |
75 | var elt = this._targets[0].elt; | 72 | var elt = this._targets[0].elt; |