From d262bb9b0c49b7bcb9fd1b429abcf6d38b39ddf6 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 1 May 2012 16:40:22 -0700 Subject: Offset side and top working planes by half the stage width/height. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/snap-manager.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 7fc492a5..f4bfc12b 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1617,7 +1617,11 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (x > y) { if (x > z) { plane[0] = 1; - plane[3] = this.getStageWidth() / 2.0; + if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + plane[3] = stage.scrollWidth / 2.0; + } else { + plane[3] = this.getStageWidth() / 2.0; + } if (dir[0] > 0) plane[3] = -plane[3]; change = !drawUtils.drawYZ; drawUtils.drawXY = drawUtils.drawXZ = false; @@ -1635,7 +1639,11 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { else { if (y > z) { plane[1] = 1; - plane[3] = this.getStageHeight() / 2.0; + if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + plane[3] = stage.scrollHeight / 2.0; + } else { + plane[3] = this.getStageHeight() / 2.0; + } if (dir[1] > 0) plane[3] = -plane[3]; change = !drawUtils.drawXZ; drawUtils.drawXY = drawUtils.drawYZ = false; -- cgit v1.2.3 From 0f16c5ea0d08a740f553284c436bb3e589fb1357 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 1 May 2012 16:49:29 -0700 Subject: Draw a red outline around the stage for reference when rotating stage. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 81a740e0..88830964 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -651,6 +651,21 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._lineColor = saveColor; this._drawingContext.lineWidth = saveLineWidth; + if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + // draw an outline around the body + var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); + var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); + // glmat4.multiply( tMat, stageMat, stageMat); + pt0 = [0, 0, 0]; + pt1 = [0, height, 0]; + delta = [width, 0, 0]; + this.drawGridLines(pt0, pt1, delta, stageMat, 2); + pt0 = [0, 0, 0]; + pt1 = [width, 0, 0]; + delta = [0, height, 0]; + this.drawGridLines(pt0, pt1, delta, stageMat, 2); + } + // draw the lines this.redrawGridLines(); @@ -752,12 +767,27 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._drawingContext.lineWidth = 0.25; // draw the lines - var nLines = this._gridLineArray.length; + var line, + nLines = this._gridLineArray.length; + if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + nLines = this._gridLineArray.length-4; + } + for (var i = 0; i < nLines; i++) { - var line = this._gridLineArray[i]; + line = this._gridLineArray[i]; this.drawIntersectedLine(line, this._drawingContext); } + if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + this._lineColor = "red"; + i = nLines; + nLines += 4; + for (; i < nLines; i++) { + line = this._gridLineArray[i]; + this.drawIntersectedLine(line, this._drawingContext); + } + } + this.popState(); } }, -- cgit v1.2.3