aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-01 07:01:44 -0700
committerNivesh Rajbhandari2012-05-01 07:01:44 -0700
commitc534f70e9af920d252d0d94151c9d6f884283b81 (patch)
treeb4c6fe88a2f27b18d3d61ffb7ac0145d74878eae /js/helper-classes
parent9c8fbdd11fdbe9ae73d57147de84b799c5a87652 (diff)
downloadninja-c534f70e9af920d252d0d94151c9d6f884283b81.tar.gz
Get working plane grid to draw for new stage web template workflow.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 7bd77c3a..f7b02485 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -583,17 +583,24 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
583 // get a point that lies on the plane 583 // get a point that lies on the plane
584 var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane); 584 var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane);
585 585
586 // define the grid parameters
587 var width,
588 height,
589 nLines = 10;
590
591 if(this.application.ninja.documentController.webTemplate) {
592 width = this.application.ninja.currentDocument.documentRoot.scrollWidth;
593 height = this.application.ninja.currentDocument.documentRoot.scrollHeight;
594 } else {
595 width = this.snapManager.getStageWidth();
596 height = this.snapManager.getStageHeight();
597 }
586 // get a matrix from working plane space to the world 598 // get a matrix from working plane space to the world
587 var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane); 599 var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane);
588 var tMat = Matrix.Translation( [0.5*this.snapManager.getStageWidth(), 0.5*this.snapManager.getStageHeight(),0] ); 600 var tMat = Matrix.Translation( [0.5*width, 0.5*height, 0] );
589 //mat = tMat.multiply(mat); 601 //mat = tMat.multiply(mat);
590 glmat4.multiply( tMat, mat, mat); 602 glmat4.multiply( tMat, mat, mat);
591 603
592 // define the grid parameters
593 var width = this.snapManager.getStageWidth(),
594 height = this.snapManager.getStageHeight();
595 var nLines = 10;
596
597 // the positioning of the grid may depend on the view direction. 604 // the positioning of the grid may depend on the view direction.
598 var stage = this.snapManager.getStage(); 605 var stage = this.snapManager.getStage();
599 var viewMat = this.viewUtils.getMatrixFromElement(stage); 606 var viewMat = this.viewUtils.getMatrixFromElement(stage);
@@ -662,6 +669,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
662 var offset = this.viewUtils.getElementOffset(this._sourceSpaceElt); 669 var offset = this.viewUtils.getElementOffset(this._sourceSpaceElt);
663 offset[2] = 0; 670 offset[2] = 0;
664 this.viewUtils.setViewportObj(this._sourceSpaceElt); 671 this.viewUtils.setViewportObj(this._sourceSpaceElt);
672 var sourceSpaceMat = this.viewUtils.getLocalToGlobalMatrix( this._sourceSpaceElt );
665 for (var i = 0; i < nLines; i++) { 673 for (var i = 0; i < nLines; i++) {
666 // transform the points from working plane space to world space 674 // transform the points from working plane space to world space
667 //var t0 = mat.multiply(p0), 675 //var t0 = mat.multiply(p0),
@@ -671,8 +679,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
671 679
672 // transform from world space to global screen space 680 // transform from world space to global screen space
673 if (this._sourceSpaceElt) { 681 if (this._sourceSpaceElt) {
674 t0 = this.viewUtils.localToGlobal(t0, this._sourceSpaceElt); 682// t0 = this.viewUtils.localToGlobal(t0, this._sourceSpaceElt);
675 t1 = this.viewUtils.localToGlobal(t1, this._sourceSpaceElt); 683// t1 = this.viewUtils.localToGlobal(t1, this._sourceSpaceElt);
684 t0 = this.viewUtils.localToGlobal2(t0, sourceSpaceMat);
685 t1 = this.viewUtils.localToGlobal2(t1, sourceSpaceMat);
676 } 686 }
677 687
678 // create a line from the endpoints 688 // create a line from the endpoints