diff options
author | Valerio Virgillito | 2012-04-17 11:08:29 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-17 11:08:29 -0700 |
commit | 2292a35f545a161c0d19b26a8640b9421afce792 (patch) | |
tree | c9a64c50dd4c42cdbd221e35548418fe883c2d13 /js/tools/RotateStage3DTool.js | |
parent | 4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff) | |
parent | 7ed5215332123d16f819a7a26c651af520a68669 (diff) | |
download | ninja-2292a35f545a161c0d19b26a8640b9421afce792.tar.gz |
Merge pull request #163 from mencio/undo-manager
Undo manager - Fixing a couple undo bugs and architecture work to support undo/redo
Diffstat (limited to 'js/tools/RotateStage3DTool.js')
-rwxr-xr-x | js/tools/RotateStage3DTool.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js index f5cc4040..a980bf73 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); |
@@ -74,7 +72,9 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
74 | 72 | ||
75 | eltCtr = viewUtils.localToGlobal(eltCtr, elt); | 73 | eltCtr = viewUtils.localToGlobal(eltCtr, elt); |
76 | 74 | ||
77 | this._targets.push({elt:elt, mat:curMat, matInv:curMatInv, ctr:eltCtr}); | 75 | elt.elementModel.setProperty("mat", curMat); |
76 | elt.elementModel.setProperty("matInv", curMatInv); | ||
77 | elt.elementModel.setProperty("ctr", eltCtr); | ||
78 | 78 | ||
79 | ElementsMediator.setMatrix(elt, curMat, false, "rotateStage3DTool"); | 79 | ElementsMediator.setMatrix(elt, curMat, false, "rotateStage3DTool"); |
80 | } | 80 | } |
@@ -83,7 +83,6 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
83 | captureSelectionDrawn: { | 83 | captureSelectionDrawn: { |
84 | value: function(event){ | 84 | value: function(event){ |
85 | this._origin = null; | 85 | this._origin = null; |
86 | this._targets = []; | ||
87 | this._startOriginArray = null; | 86 | this._startOriginArray = null; |
88 | 87 | ||
89 | var stage = this.application.ninja.currentDocument.documentRoot; | 88 | var stage = this.application.ninja.currentDocument.documentRoot; |
@@ -93,12 +92,12 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
93 | var eltCtr = viewUtils.getCenterOfProjection(); | 92 | var eltCtr = viewUtils.getCenterOfProjection(); |
94 | viewUtils.popViewportObj(); | 93 | viewUtils.popViewportObj(); |
95 | 94 | ||
96 | this._targets = []; | ||
97 | |||
98 | var curMat = viewUtils.getMatrixFromElement(stage); | 95 | var curMat = viewUtils.getMatrixFromElement(stage); |
99 | var curMatInv = glmat4.inverse(curMat, []); | 96 | var curMatInv = glmat4.inverse(curMat, []); |
100 | 97 | ||
101 | this._targets.push({elt:stage, mat:curMat, matInv:curMatInv, ctr:eltCtr}); | 98 | stage.elementModel.setProperty("mat", curMat); |
99 | stage.elementModel.setProperty("matInv", curMatInv); | ||
100 | stage.elementModel.setProperty("ctr", eltCtr); | ||
102 | 101 | ||
103 | var ctrOffset = stage.elementModel.props3D.m_transformCtr; | 102 | var ctrOffset = stage.elementModel.props3D.m_transformCtr; |
104 | if(ctrOffset) | 103 | if(ctrOffset) |
@@ -149,6 +148,6 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
149 | // this.UpdateSelection(true); | 148 | // this.UpdateSelection(true); |
150 | this.Configure(true); | 149 | this.Configure(true); |
151 | } | 150 | } |
152 | } | 151 | } |
153 | 152 | ||
154 | }); | 153 | }); |