diff options
Diffstat (limited to 'js/helper-classes/3D/draw-utils.js')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 871b832d..bef1e435 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -112,7 +112,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
112 | this.eventManager.addEventListener("elementsRemoved", this, false); | 112 | this.eventManager.addEventListener("elementsRemoved", this, false); |
113 | this.eventManager.addEventListener("elementChange", this, false); | 113 | this.eventManager.addEventListener("elementChange", this, false); |
114 | this.eventManager.addEventListener("elementChanging", this, false); | 114 | this.eventManager.addEventListener("elementChanging", this, false); |
115 | this.eventManager.addEventListener("closeDocument", this, false); | ||
116 | this.eventManager.addEventListener("elementReplaced", this, false); | 115 | this.eventManager.addEventListener("elementReplaced", this, false); |
117 | } | 116 | } |
118 | }, | 117 | }, |
@@ -126,7 +125,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
126 | //initialize with current document | 125 | //initialize with current document |
127 | this._eltArray = []; | 126 | this._eltArray = []; |
128 | this._planesArray = []; | 127 | this._planesArray = []; |
129 | this.setDrawingSurfaceElement(stage.canvas); | 128 | this.setDrawingSurfaceElement(stage.gridCanvas); |
130 | this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); | 129 | this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); |
131 | this.setWorkingPlane( [0,0,1,0] ); | 130 | this.setWorkingPlane( [0,0,1,0] ); |
132 | 131 | ||
@@ -164,15 +163,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
164 | } | 163 | } |
165 | }, | 164 | }, |
166 | 165 | ||
167 | handleCloseDocument:{ | ||
168 | value: function() { | ||
169 | if(this.application.ninja.documentController._documents.length === 0){ | ||
170 | this._eltArray.length = 0; | ||
171 | this._planesArray.length = 0; | ||
172 | } | ||
173 | } | ||
174 | }, | ||
175 | |||
176 | handleElementAdded: { | 166 | handleElementAdded: { |
177 | value: function(event) { | 167 | value: function(event) { |
178 | var elements = event.detail; | 168 | var elements = event.detail; |
@@ -276,8 +266,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
276 | stage = this.application.ninja.stage, | 266 | stage = this.application.ninja.stage, |
277 | minLeft = stage.userPaddingLeft, | 267 | minLeft = stage.userPaddingLeft, |
278 | minTop = stage.userPaddingTop, | 268 | minTop = stage.userPaddingTop, |
279 | docLeft = stage.documentOffsetLeft, | 269 | docLeft = stage.userContentLeft, |
280 | docTop = stage.documentOffsetTop, | 270 | docTop = stage.userContentTop, |
281 | l, | 271 | l, |
282 | t, | 272 | t, |
283 | plane, | 273 | plane, |
@@ -307,7 +297,6 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
307 | } | 297 | } |
308 | 298 | ||
309 | if(!changed) { | 299 | if(!changed) { |
310 | stage.layout.draw(); | ||
311 | this.drawWorkingPlane(); | 300 | this.drawWorkingPlane(); |
312 | this.draw3DCompass(); | 301 | this.draw3DCompass(); |
313 | } | 302 | } |
@@ -628,11 +617,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
628 | { | 617 | { |
629 | value: function () | 618 | value: function () |
630 | { | 619 | { |
620 | this.application.ninja.stage.clearGridCanvas(); | ||
631 | if (!this.isDrawingGrid()) return; | 621 | if (!this.isDrawingGrid()) return; |
632 | 622 | ||
633 | var saveContext = this.getDrawingSurfaceElement(); | 623 | var saveContext = this.getDrawingSurfaceElement(); |
634 | //this.setDrawingSurfaceElement(window.stageManager.layoutCanvas); | 624 | this.setDrawingSurfaceElement(this.application.ninja.stage.gridCanvas); |
635 | this.setDrawingSurfaceElement(this.application.ninja.stage.layoutCanvas); | ||
636 | 625 | ||
637 | // 3 coordinate axes for the plane | 626 | // 3 coordinate axes for the plane |
638 | var zAxis = [this._workingPlane[0], this._workingPlane[1], this._workingPlane[2]]; | 627 | var zAxis = [this._workingPlane[0], this._workingPlane[1], this._workingPlane[2]]; |
@@ -1217,7 +1206,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1217 | // set the element to be the viewport object - temporarily | 1206 | // set the element to be the viewport object - temporarily |
1218 | var tmpCanvas = this.application.ninja.stage.canvas; | 1207 | var tmpCanvas = this.application.ninja.stage.canvas; |
1219 | var tmpStage = this.application.ninja.currentDocument.model.documentRoot; | 1208 | var tmpStage = this.application.ninja.currentDocument.model.documentRoot; |
1220 | this.viewUtils.pushViewportObj( tmpCanvas ); | 1209 | // this.viewUtils.pushViewportObj( tmpCanvas ); |
1221 | 1210 | ||
1222 | // save the source space object and set to the target object | 1211 | // save the source space object and set to the target object |
1223 | var saveSource = this._sourceSpaceElt; | 1212 | var saveSource = this._sourceSpaceElt; |
@@ -1228,7 +1217,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1228 | var saveLineWidth = this._lineWidth; | 1217 | var saveLineWidth = this._lineWidth; |
1229 | 1218 | ||
1230 | var origLeft = 60; | 1219 | var origLeft = 60; |
1231 | var origTop = this.snapManager.getStageHeight() - 60; | 1220 | var origTop = tmpCanvas.height - 60; |
1232 | 1221 | ||
1233 | var mat = this.viewUtils.getMatrixFromElement( this._sourceSpaceElt ); | 1222 | var mat = this.viewUtils.getMatrixFromElement( this._sourceSpaceElt ); |
1234 | var tMat = Matrix.Translation([origLeft,origTop,0]); | 1223 | var tMat = Matrix.Translation([origLeft,origTop,0]); |
@@ -1290,7 +1279,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1290 | this.drawArrowHead(rO, zO); | 1279 | this.drawArrowHead(rO, zO); |
1291 | 1280 | ||
1292 | // restore the state | 1281 | // restore the state |
1293 | this.viewUtils.popViewportObj(); | 1282 | // this.viewUtils.popViewportObj(); |
1294 | this._drawingContext.restore(); | 1283 | this._drawingContext.restore(); |
1295 | this.setDrawingSurfaceElement(saveContext); | 1284 | this.setDrawingSurfaceElement(saveContext); |
1296 | this._lineColor = saveColor; | 1285 | this._lineColor = saveColor; |