diff options
author | Pushkar Joshi | 2012-05-31 17:16:21 -0700 |
---|---|---|
committer | Pushkar Joshi | 2012-05-31 17:16:21 -0700 |
commit | 8915a7109d918a2e69b0999ebaa2deb84811fef8 (patch) | |
tree | 19a8af74c58c9ea261f0842f36efdab959be3256 /js/tools/RotateStage3DTool.js | |
parent | eea0a556e44c2b60d3aaf6e46d2432d3e6303812 (diff) | |
parent | 06b609df1ff7833592faddbd8d7abb5b9f15a74d (diff) | |
download | ninja-8915a7109d918a2e69b0999ebaa2deb84811fef8.tar.gz |
Merge branch 'pentool' into brushtool
Diffstat (limited to 'js/tools/RotateStage3DTool.js')
-rwxr-xr-x | js/tools/RotateStage3DTool.js | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js index 2a9c63db..12b21a64 100755 --- a/js/tools/RotateStage3DTool.js +++ b/js/tools/RotateStage3DTool.js | |||
@@ -90,18 +90,12 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
90 | this._origin = null; | 90 | this._origin = null; |
91 | this._startOriginArray = null; | 91 | this._startOriginArray = null; |
92 | 92 | ||
93 | var stage = this.application.ninja.currentDocument.documentRoot; | 93 | var stage = this.application.ninja.currentDocument.model.documentRoot; |
94 | this.target = stage; | 94 | this.target = stage; |
95 | 95 | ||
96 | viewUtils.pushViewportObj( stage ); | 96 | viewUtils.pushViewportObj( stage ); |
97 | var eltCtr = viewUtils.getCenterOfProjection(); | 97 | var eltCtr = viewUtils.getCenterOfProjection(); |
98 | viewUtils.popViewportObj(); | 98 | viewUtils.popViewportObj(); |
99 | // if(this.application.ninja.documentController.webTemplate) | ||
100 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") | ||
101 | { | ||
102 | eltCtr[0] = stage.scrollWidth/2; | ||
103 | eltCtr[1] = stage.scrollHeight/2; | ||
104 | } | ||
105 | 99 | ||
106 | var curMat = viewUtils.getMatrixFromElement(stage); | 100 | var curMat = viewUtils.getMatrixFromElement(stage); |
107 | var curMatInv = glmat4.inverse(curMat, []); | 101 | var curMatInv = glmat4.inverse(curMat, []); |
@@ -118,24 +112,14 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
118 | } | 112 | } |
119 | 113 | ||
120 | this._origin = viewUtils.localToGlobal(eltCtr, stage); | 114 | this._origin = viewUtils.localToGlobal(eltCtr, stage); |
121 | 115 | this._setTransformOrigin(false); | |
122 | // if(this.application.ninja.documentController.webTemplate) | ||
123 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") | ||
124 | { | ||
125 | this._startOriginArray = []; | ||
126 | this._startOriginArray.push(this._origin.slice()); | ||
127 | } | ||
128 | else | ||
129 | { | ||
130 | this._setTransformOrigin(false); | ||
131 | } | ||
132 | this.DrawHandles(); | 116 | this.DrawHandles(); |
133 | } | 117 | } |
134 | }, | 118 | }, |
135 | 119 | ||
136 | captureElementChange: { | 120 | captureElementChange: { |
137 | value: function(event) { | 121 | value: function(event) { |
138 | if(event._event.item === this.application.ninja.currentDocument.documentRoot) | 122 | if(event._event.item === this.application.ninja.currentDocument.model.documentRoot) |
139 | { | 123 | { |
140 | this.captureSelectionDrawn(null); | 124 | this.captureSelectionDrawn(null); |
141 | } | 125 | } |
@@ -146,20 +130,22 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { | |||
146 | value : function() | 130 | value : function() |
147 | { | 131 | { |
148 | // Reset stage to identity matrix | 132 | // Reset stage to identity matrix |
149 | var iMat = Matrix.I(4); | 133 | var iMat = Matrix.I(4), |
134 | stage = this.application.ninja.stage; | ||
150 | 135 | ||
151 | ElementsMediator.setMatrix(this.application.ninja.currentDocument.documentRoot, | 136 | ElementsMediator.setMatrix(this.application.ninja.currentDocument.model.documentRoot, |
152 | iMat, false, "rotateStage3DTool"); | 137 | iMat, false, "rotateStage3DTool"); |
153 | this.application.ninja.currentDocument.documentRoot.elementModel.props3D.m_transformCtr = null; | 138 | this.application.ninja.currentDocument.model.documentRoot.elementModel.props3D.m_transformCtr = null; |
154 | 139 | ||
155 | // let the document and stage manager know about the zoom change | 140 | // let the document and stage manager know about the zoom change |
156 | this.application.ninja.stage._firstDraw = true; | 141 | stage._firstDraw = true; |
157 | this.application.ninja.documentBar.zoomFactor = 100; | 142 | this.application.ninja.documentBar.zoomFactor = 100; |
158 | this.application.ninja.currentDocument.iframe.style.zoom = 1.0; | 143 | this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = 1.0; |
159 | this.application.ninja.stage._firstDraw = false; | 144 | stage._firstDraw = false; |
160 | 145 | ||
161 | // TODO - Any updates to the stage should redraw stage's children. Move this to mediator? | 146 | viewUtils.clearStageTranslation(); |
162 | this.application.ninja.stage.updatedStage = true; | 147 | stage.centerStage(); |
148 | stage.draw(); | ||
163 | 149 | ||
164 | this.isDrawing = false; | 150 | this.isDrawing = false; |
165 | this.endDraw(event); | 151 | this.endDraw(event); |