aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/draw-utils.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-25 11:53:19 -0700
committerJose Antonio Marquez2012-06-25 11:53:19 -0700
commit245e70117f9605dc5603328c97685b2e5a10f220 (patch)
tree063b1b147b246bd93b259a2d84d3bc70928f4174 /js/helper-classes/3D/draw-utils.js
parente74b08a510176d163da9e0bdd771d9b28176a12a (diff)
parentde38cd3479bd5865e058938095120fa3526fc9b3 (diff)
downloadninja-245e70117f9605dc5603328c97685b2e5a10f220.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'js/helper-classes/3D/draw-utils.js')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js32
1 files changed, 31 insertions, 1 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index bd47ffc3..87151964 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -1185,8 +1185,38 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
1185 var context = this.application.ninja.stage.gridContext; 1185 var context = this.application.ninja.stage.gridContext;
1186 var stage = this.application.ninja.stage; 1186 var stage = this.application.ninja.stage;
1187 var stageRoot = this.application.ninja.currentDocument.model.documentRoot; 1187 var stageRoot = this.application.ninja.currentDocument.model.documentRoot;
1188 var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot);
1189 1188
1189 // draw an outline around the template body if stage has any transforms
1190 if(stage.currentDocument.model.views.design._template && !MathUtils.isIdentityMatrix(this.viewUtils.getMatrixFromElement(stageRoot))) {
1191 var saveContext = this.getDrawingSurfaceElement();
1192 this.setDrawingSurfaceElement(this.application.ninja.stage.gridCanvas);
1193
1194 var stagePt = MathUtils.getPointOnPlane([0,0,1,0]);
1195 var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt);
1196 var width = this.snapManager.getStageWidth(),
1197 height = this.snapManager.getStageHeight(),
1198 pt0 = [0, 0, 0],
1199 pt1 = [0, height, 0],
1200 delta = [width, 0, 0];
1201
1202 this._gridLineArray.length = 0;
1203 this.drawGridLines(pt0, pt1, delta, stageMat, 2);
1204
1205 pt0 = [0, 0, 0];
1206 pt1 = [width, 0, 0];
1207 delta = [0, height, 0];
1208 this.drawGridLines(pt0, pt1, delta, stageMat, 2);
1209
1210 this._lineColor = "red";
1211 for (var i = 0; i < 4; i++) {
1212 this.drawIntersectedLine(this._gridLineArray[i], this._drawingContext);
1213 }
1214
1215 this.setDrawingSurfaceElement(saveContext);
1216 }
1217
1218 // draw reference lines across origin
1219 var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot);
1190 var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1); 1220 var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1);
1191 if(!l) return; 1221 if(!l) return;
1192 var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); 1222 var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1);