diff options
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 46 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 4 | ||||
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 8 |
3 files changed, 41 insertions, 17 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 | }, |
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 7fc492a5..31e3e540 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -1617,7 +1617,7 @@ 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 | plane[3] = this.getStageWidth() / 2.0; |
1621 | if (dir[0] > 0) plane[3] = -plane[3]; | 1621 | if (dir[0] > 0) plane[3] = -plane[3]; |
1622 | change = !drawUtils.drawYZ; | 1622 | change = !drawUtils.drawYZ; |
1623 | drawUtils.drawXY = drawUtils.drawXZ = false; | 1623 | drawUtils.drawXY = drawUtils.drawXZ = false; |
@@ -1635,7 +1635,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1635 | else { | 1635 | else { |
1636 | if (y > z) { | 1636 | if (y > z) { |
1637 | plane[1] = 1; | 1637 | plane[1] = 1; |
1638 | plane[3] = this.getStageHeight() / 2.0; | 1638 | plane[3] = this.getStageHeight() / 2.0; |
1639 | if (dir[1] > 0) plane[3] = -plane[3]; | 1639 | if (dir[1] > 0) plane[3] = -plane[3]; |
1640 | change = !drawUtils.drawXZ; | 1640 | change = !drawUtils.drawXZ; |
1641 | drawUtils.drawXY = drawUtils.drawYZ = false; | 1641 | drawUtils.drawXY = drawUtils.drawYZ = false; |
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 40a19b90..36d6f8c4 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -309,11 +309,12 @@ exports.ViewUtils = Montage.create(Component, { | |||
309 | // transform the bounds up the tree | 309 | // transform the bounds up the tree |
310 | var child = elt; | 310 | var child = elt; |
311 | var parent = elt.offsetParent; | 311 | var parent = elt.offsetParent; |
312 | while ( parent ) | 312 | while ( child ) |
313 | { | 313 | { |
314 | pt = this.childToParent( pt, child ); | 314 | pt = this.childToParent( pt, child ); |
315 | 315 | ||
316 | if (parent === this._rootElement) break; | 316 | // if (parent === this._rootElement) break; |
317 | if (child === this._stageElement) break; | ||
317 | 318 | ||
318 | child = parent; | 319 | child = parent; |
319 | parent = parent.offsetParent; | 320 | parent = parent.offsetParent; |
@@ -352,7 +353,8 @@ exports.ViewUtils = Montage.create(Component, { | |||
352 | 353 | ||
353 | // transform the bounds up the tree | 354 | // transform the bounds up the tree |
354 | var parent = child.offsetParent; | 355 | var parent = child.offsetParent; |
355 | if ( parent ) | 356 | // TODO - Should have a different way to check for new template mode |
357 | if ( parent || ((child === this.application.ninja.currentDocument.documentRoot) && (child.id !== "UserContent")) ) | ||
356 | { | 358 | { |
357 | this.setViewportObj( child ); | 359 | this.setViewportObj( child ); |
358 | 360 | ||