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 | |
parent | 4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c (diff) | |
download | ninja-642d7b45446894a2f3038dcc07a867b260968256.tar.gz |
3D rotation
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 2 | ||||
-rwxr-xr-x | js/tools/Rotate3DToolBase.js | 19 | ||||
-rwxr-xr-x | js/tools/Translate3DToolBase.js | 5 |
3 files changed, 9 insertions, 17 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 5735a145..14a621d0 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -307,7 +307,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
307 | 307 | ||
308 | this.setLastHit( rtnHit ); | 308 | this.setLastHit( rtnHit ); |
309 | 309 | ||
310 | rtnHit.test(); // DEBUG CODE. REMOVE THIS | 310 | //rtnHit.test(); // DEBUG CODE. REMOVE THIS |
311 | return rtnHit; | 311 | return rtnHit; |
312 | } | 312 | } |
313 | }, | 313 | }, |
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; |
diff --git a/js/tools/Translate3DToolBase.js b/js/tools/Translate3DToolBase.js index ac98d018..a39dafad 100755 --- a/js/tools/Translate3DToolBase.js +++ b/js/tools/Translate3DToolBase.js | |||
@@ -204,11 +204,6 @@ exports.Translate3DToolBase = Montage.create(ModifierToolBase, | |||
204 | 204 | ||
205 | _updateTargets: { | 205 | _updateTargets: { |
206 | value: function(addToUndoStack) { | 206 | value: function(addToUndoStack) { |
207 | { | ||
208 | { | ||
209 | // console.log( "_updateTargets" ); | ||
210 | console.log( "_updateTargets" ); | ||
211 | //console.log( "_updateTargets" ); | ||
212 | var newStyles = [], | 207 | var newStyles = [], |
213 | previousStyles = [], | 208 | previousStyles = [], |
214 | len = this.application.ninja.selectedElements.length; | 209 | len = this.application.ninja.selectedElements.length; |