diff options
Diffstat (limited to 'js/helper-classes/3D/draw-utils.js')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 81a740e0..f869f65e 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -584,18 +584,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
584 | var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane); | 584 | var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane); |
585 | 585 | ||
586 | // define the grid parameters | 586 | // define the grid parameters |
587 | var width, | 587 | var width = this.snapManager.getStageWidth(), |
588 | height, | 588 | height = this.snapManager.getStageHeight(), |
589 | nLines = 10; | 589 | nLines = 10; |
590 | 590 | ||
591 | // if(this.application.ninja.documentController.webTemplate) { | ||
592 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | ||
593 | width = this.application.ninja.currentDocument.documentRoot.scrollWidth; | ||
594 | height = this.application.ninja.currentDocument.documentRoot.scrollHeight; | ||
595 | } else { | ||
596 | width = this.snapManager.getStageWidth(); | ||
597 | height = this.snapManager.getStageHeight(); | ||
598 | } | ||
599 | // get a matrix from working plane space to the world | 591 | // get a matrix from working plane space to the world |
600 | var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane); | 592 | var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane); |
601 | var tMat = Matrix.Translation( [0.5*width, 0.5*height, 0] ); | 593 | var tMat = Matrix.Translation( [0.5*width, 0.5*height, 0] ); |
@@ -651,6 +643,21 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
651 | this._lineColor = saveColor; | 643 | this._lineColor = saveColor; |
652 | this._drawingContext.lineWidth = saveLineWidth; | 644 | this._drawingContext.lineWidth = saveLineWidth; |
653 | 645 | ||
646 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | ||
647 | // draw an outline around the body | ||
648 | var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); | ||
649 | var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); | ||
650 | // glmat4.multiply( tMat, stageMat, stageMat); | ||
651 | pt0 = [0, 0, 0]; | ||
652 | pt1 = [0, height, 0]; | ||
653 | delta = [width, 0, 0]; | ||
654 | this.drawGridLines(pt0, pt1, delta, stageMat, 2); | ||
655 | pt0 = [0, 0, 0]; | ||
656 | pt1 = [width, 0, 0]; | ||
657 | delta = [0, height, 0]; | ||
658 | this.drawGridLines(pt0, pt1, delta, stageMat, 2); | ||
659 | } | ||
660 | |||
654 | // draw the lines | 661 | // draw the lines |
655 | this.redrawGridLines(); | 662 | this.redrawGridLines(); |
656 | 663 | ||
@@ -752,12 +759,27 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
752 | this._drawingContext.lineWidth = 0.25; | 759 | this._drawingContext.lineWidth = 0.25; |
753 | 760 | ||
754 | // draw the lines | 761 | // draw the lines |
755 | var nLines = this._gridLineArray.length; | 762 | var line, |
763 | nLines = this._gridLineArray.length; | ||
764 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | ||
765 | nLines = this._gridLineArray.length-4; | ||
766 | } | ||
767 | |||
756 | for (var i = 0; i < nLines; i++) { | 768 | for (var i = 0; i < nLines; i++) { |
757 | var line = this._gridLineArray[i]; | 769 | line = this._gridLineArray[i]; |
758 | this.drawIntersectedLine(line, this._drawingContext); | 770 | this.drawIntersectedLine(line, this._drawingContext); |
759 | } | 771 | } |
760 | 772 | ||
773 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | ||
774 | this._lineColor = "red"; | ||
775 | i = nLines; | ||
776 | nLines += 4; | ||
777 | for (; i < nLines; i++) { | ||
778 | line = this._gridLineArray[i]; | ||
779 | this.drawIntersectedLine(line, this._drawingContext); | ||
780 | } | ||
781 | } | ||
782 | |||
761 | this.popState(); | 783 | this.popState(); |
762 | } | 784 | } |
763 | }, | 785 | }, |