aboutsummaryrefslogtreecommitdiff
path: root/js/tools/RotateStage3DTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/RotateStage3DTool.js')
-rwxr-xr-xjs/tools/RotateStage3DTool.js40
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);