diff options
author | Nivesh Rajbhandari | 2012-04-18 12:08:46 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-18 12:08:46 -0700 |
commit | fb20a74856a8c272d09d106765eb2e44c883f0c3 (patch) | |
tree | d41468b2fff52d73c6308de9730c17be05a71394 /js/tools/RotateStage3DTool.js | |
parent | e2510cba3b75bba78c587d784f39c137c1618369 (diff) | |
parent | 616a8532099fec2a15855eac97cd85cb60c4451c (diff) | |
download | ninja-fb20a74856a8c272d09d106765eb2e44c883f0c3.tar.gz |
Merge branch 'refs/heads/ninja-internal' into EricMerge
Conflicts:
js/tools/Rotate3DToolBase.js
js/tools/RotateStage3DTool.js
js/tools/Translate3DToolBase.js
js/tools/modifier-tool-base.js
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/tools/RotateStage3DTool.js')
-rwxr-xr-x | js/tools/RotateStage3DTool.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js index c0808de3..d1701304 100755 --- a/js/tools/RotateStage3DTool.js +++ b/js/tools/RotateStage3DTool.js | |||
@@ -7,10 +7,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | Rotate3DToolBase = require("js/tools/Rotate3DToolBase").Rotate3DToolBase, | 8 | Rotate3DToolBase = require("js/tools/Rotate3DToolBase").Rotate3DToolBase, |
9 | toolHandleModule = require("js/stage/tool-handle"), | 9 | toolHandleModule = require("js/stage/tool-handle"), |
10 | snapManager = require("js/helper-classes/3D/snap-manager").SnapManager, | ||
11 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, | 10 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, |
12 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, | 11 | vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils, |
13 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, | ||
14 | ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | 12 | ElementsMediator = require("js/mediators/element-mediator").ElementMediator; |
15 | 13 | ||
16 | exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | 14 | exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { |
@@ -23,6 +21,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
23 | 21 | ||
24 | _initializeToolHandles: { | 22 | _initializeToolHandles: { |
25 | value: function() { | 23 | value: function() { |
24 | this.rotateStage = true; | ||
26 | if(!this._handles) | 25 | if(!this._handles) |
27 | { | 26 | { |
28 | this._handles = []; | 27 | this._handles = []; |
@@ -62,7 +61,6 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
62 | 61 | ||
63 | _updateTargets: { | 62 | _updateTargets: { |
64 | value: function(addToUndoStack) { | 63 | value: function(addToUndoStack) { |
65 | this._targets = []; | ||
66 | var elt = this._target; | 64 | var elt = this._target; |
67 | 65 | ||
68 | var curMat = viewUtils.getMatrixFromElement(elt); | 66 | var curMat = viewUtils.getMatrixFromElement(elt); |
@@ -76,7 +74,12 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
76 | var l2gMat = viewUtils.getLocalToGlobalMatrix( elt ); | 74 | var l2gMat = viewUtils.getLocalToGlobalMatrix( elt ); |
77 | var g2lMat = glmat4.inverse( l2gMat, [] ); | 75 | var g2lMat = glmat4.inverse( l2gMat, [] ); |
78 | eltCtr = MathUtils.transformAndDivideHomogeneousPoint( eltCtr, l2gMat ); | 76 | eltCtr = MathUtils.transformAndDivideHomogeneousPoint( eltCtr, l2gMat ); |
79 | this._targets.push({elt:elt, mat:curMat, matInv:curMatInv, ctr:eltCtr, l2g:l2gMat, g2l:g2lMat}); | 77 | |
78 | elt.elementModel.setProperty("mat", curMat); | ||
79 | elt.elementModel.setProperty("matInv", curMatInv); | ||
80 | elt.elementModel.setProperty("ctr", eltCtr); | ||
81 | elt.elementModel.setProperty("l2g", l2gMat); | ||
82 | elt.elementModel.setProperty("g2l", g2lMat); | ||
80 | 83 | ||
81 | ElementsMediator.setMatrix(elt, curMat, false, "rotateStage3DTool"); | 84 | ElementsMediator.setMatrix(elt, curMat, false, "rotateStage3DTool"); |
82 | } | 85 | } |
@@ -85,7 +88,6 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
85 | captureSelectionDrawn: { | 88 | captureSelectionDrawn: { |
86 | value: function(event){ | 89 | value: function(event){ |
87 | this._origin = null; | 90 | this._origin = null; |
88 | this._targets = []; | ||
89 | this._startOriginArray = null; | 91 | this._startOriginArray = null; |
90 | 92 | ||
91 | var stage = this.application.ninja.currentDocument.documentRoot; | 93 | var stage = this.application.ninja.currentDocument.documentRoot; |
@@ -95,12 +97,12 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
95 | var eltCtr = viewUtils.getCenterOfProjection(); | 97 | var eltCtr = viewUtils.getCenterOfProjection(); |
96 | viewUtils.popViewportObj(); | 98 | viewUtils.popViewportObj(); |
97 | 99 | ||
98 | this._targets = []; | ||
99 | |||
100 | var curMat = viewUtils.getMatrixFromElement(stage); | 100 | var curMat = viewUtils.getMatrixFromElement(stage); |
101 | var curMatInv = glmat4.inverse(curMat, []); | 101 | var curMatInv = glmat4.inverse(curMat, []); |
102 | 102 | ||
103 | this._targets.push({elt:stage, mat:curMat, matInv:curMatInv, ctr:eltCtr}); | 103 | stage.elementModel.setProperty("mat", curMat); |
104 | stage.elementModel.setProperty("matInv", curMatInv); | ||
105 | stage.elementModel.setProperty("ctr", eltCtr); | ||
104 | 106 | ||
105 | var ctrOffset = stage.elementModel.props3D.m_transformCtr; | 107 | var ctrOffset = stage.elementModel.props3D.m_transformCtr; |
106 | if(ctrOffset) | 108 | if(ctrOffset) |
@@ -151,6 +153,6 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
151 | // this.UpdateSelection(true); | 153 | // this.UpdateSelection(true); |
152 | this.Configure(true); | 154 | this.Configure(true); |
153 | } | 155 | } |
154 | } | 156 | } |
155 | 157 | ||
156 | }); | 158 | }); |