diff options
author | Valerio Virgillito | 2012-05-02 14:53:21 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-02 14:53:21 -0700 |
commit | 691beb1c39fc0baa683f1fc56cbc519fe58f306d (patch) | |
tree | feb28083c4540ea6298a8d6d3410ffa0e9c15527 /js/helper-classes | |
parent | e3fa4c7db57b63c5ac604c9420062de5d0fe413a (diff) | |
parent | 355656cac2fa1a025ad97791ea095a54cebdff71 (diff) | |
download | ninja-691beb1c39fc0baa683f1fc56cbc519fe58f306d.tar.gz |
Merge pull request #186 from mqg734/StageWebTemplate
More grid drawing fixes for new web template workflow. Also, adding back ability to draw when working plane changes.
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 34 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 12 |
2 files changed, 42 insertions, 4 deletions
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, { | |||
651 | this._lineColor = saveColor; | 651 | this._lineColor = saveColor; |
652 | this._drawingContext.lineWidth = saveLineWidth; | 652 | this._drawingContext.lineWidth = saveLineWidth; |
653 | 653 | ||
654 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | ||
655 | // draw an outline around the body | ||
656 | var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); | ||
657 | var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); | ||
658 | // glmat4.multiply( tMat, stageMat, stageMat); | ||
659 | pt0 = [0, 0, 0]; | ||
660 | pt1 = [0, height, 0]; | ||
661 | delta = [width, 0, 0]; | ||
662 | this.drawGridLines(pt0, pt1, delta, stageMat, 2); | ||
663 | pt0 = [0, 0, 0]; | ||
664 | pt1 = [width, 0, 0]; | ||
665 | delta = [0, height, 0]; | ||
666 | this.drawGridLines(pt0, pt1, delta, stageMat, 2); | ||
667 | } | ||
668 | |||
654 | // draw the lines | 669 | // draw the lines |
655 | this.redrawGridLines(); | 670 | this.redrawGridLines(); |
656 | 671 | ||
@@ -752,12 +767,27 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
752 | this._drawingContext.lineWidth = 0.25; | 767 | this._drawingContext.lineWidth = 0.25; |
753 | 768 | ||
754 | // draw the lines | 769 | // draw the lines |
755 | var nLines = this._gridLineArray.length; | 770 | var line, |
771 | nLines = this._gridLineArray.length; | ||
772 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | ||
773 | nLines = this._gridLineArray.length-4; | ||
774 | } | ||
775 | |||
756 | for (var i = 0; i < nLines; i++) { | 776 | for (var i = 0; i < nLines; i++) { |
757 | var line = this._gridLineArray[i]; | 777 | line = this._gridLineArray[i]; |
758 | this.drawIntersectedLine(line, this._drawingContext); | 778 | this.drawIntersectedLine(line, this._drawingContext); |
759 | } | 779 | } |
760 | 780 | ||
781 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | ||
782 | this._lineColor = "red"; | ||
783 | i = nLines; | ||
784 | nLines += 4; | ||
785 | for (; i < nLines; i++) { | ||
786 | line = this._gridLineArray[i]; | ||
787 | this.drawIntersectedLine(line, this._drawingContext); | ||
788 | } | ||
789 | } | ||
790 | |||
761 | this.popState(); | 791 | this.popState(); |
762 | } | 792 | } |
763 | }, | 793 | }, |
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, { | |||
1617 | if (x > y) { | 1617 | if (x > y) { |
1618 | if (x > z) { | 1618 | if (x > z) { |
1619 | plane[0] = 1; | 1619 | plane[0] = 1; |
1620 | plane[3] = this.getStageWidth() / 2.0; | 1620 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { |
1621 | plane[3] = stage.scrollWidth / 2.0; | ||
1622 | } else { | ||
1623 | plane[3] = this.getStageWidth() / 2.0; | ||
1624 | } | ||
1621 | if (dir[0] > 0) plane[3] = -plane[3]; | 1625 | if (dir[0] > 0) plane[3] = -plane[3]; |
1622 | change = !drawUtils.drawYZ; | 1626 | change = !drawUtils.drawYZ; |
1623 | drawUtils.drawXY = drawUtils.drawXZ = false; | 1627 | drawUtils.drawXY = drawUtils.drawXZ = false; |
@@ -1635,7 +1639,11 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1635 | else { | 1639 | else { |
1636 | if (y > z) { | 1640 | if (y > z) { |
1637 | plane[1] = 1; | 1641 | plane[1] = 1; |
1638 | plane[3] = this.getStageHeight() / 2.0; | 1642 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { |
1643 | plane[3] = stage.scrollHeight / 2.0; | ||
1644 | } else { | ||
1645 | plane[3] = this.getStageHeight() / 2.0; | ||
1646 | } | ||
1639 | if (dir[1] > 0) plane[3] = -plane[3]; | 1647 | if (dir[1] > 0) plane[3] = -plane[3]; |
1640 | change = !drawUtils.drawXZ; | 1648 | change = !drawUtils.drawXZ; |
1641 | drawUtils.drawXY = drawUtils.drawYZ = false; | 1649 | drawUtils.drawXY = drawUtils.drawYZ = false; |