aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/RotateStage3DTool.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js
index f5cc4040..c0808de3 100755
--- a/js/tools/RotateStage3DTool.js
+++ b/js/tools/RotateStage3DTool.js
@@ -72,9 +72,11 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
72 var eltCtr = viewUtils.getCenterOfProjection(); 72 var eltCtr = viewUtils.getCenterOfProjection();
73 viewUtils.popViewportObj(); 73 viewUtils.popViewportObj();
74 74
75 eltCtr = viewUtils.localToGlobal(eltCtr, elt); 75 // cache the local to global and global to local matrices
76 76 var l2gMat = viewUtils.getLocalToGlobalMatrix( elt );
77 this._targets.push({elt:elt, mat:curMat, matInv:curMatInv, ctr:eltCtr}); 77 var g2lMat = glmat4.inverse( l2gMat, [] );
78 eltCtr = MathUtils.transformAndDivideHomogeneousPoint( eltCtr, l2gMat );
79 this._targets.push({elt:elt, mat:curMat, matInv:curMatInv, ctr:eltCtr, l2g:l2gMat, g2l:g2lMat});
78 80
79 ElementsMediator.setMatrix(elt, curMat, false, "rotateStage3DTool"); 81 ElementsMediator.setMatrix(elt, curMat, false, "rotateStage3DTool");
80 } 82 }