From 8f8f7f9a36fb9abadea2a9f25aef0084946bebc9 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 4 May 2012 14:42:00 -0700 Subject: Removed special-casing for new template workflow. Instead, we will enforce a width and height on the body in order to do 3d. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 12 ++---------- js/helper-classes/3D/snap-manager.js | 12 ++---------- js/helper-classes/3D/view-utils.js | 8 +++++--- 3 files changed, 9 insertions(+), 23 deletions(-) (limited to 'js/helper-classes') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index 88830964..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, { var ptOnPlane = MathUtils.getPointOnPlane(this._workingPlane); // define the grid parameters - var width, - height, + var width = this.snapManager.getStageWidth(), + height = this.snapManager.getStageHeight(), nLines = 10; -// if(this.application.ninja.documentController.webTemplate) { - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { - width = this.application.ninja.currentDocument.documentRoot.scrollWidth; - height = this.application.ninja.currentDocument.documentRoot.scrollHeight; - } else { - width = this.snapManager.getStageWidth(); - height = this.snapManager.getStageHeight(); - } // get a matrix from working plane space to the world var mat = this.getPlaneToWorldMatrix(zAxis, ptOnPlane); var tMat = Matrix.Translation( [0.5*width, 0.5*height, 0] ); diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index f4bfc12b..31e3e540 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1617,11 +1617,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (x > y) { if (x > z) { plane[0] = 1; - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { - plane[3] = stage.scrollWidth / 2.0; - } else { - plane[3] = this.getStageWidth() / 2.0; - } + plane[3] = this.getStageWidth() / 2.0; if (dir[0] > 0) plane[3] = -plane[3]; change = !drawUtils.drawYZ; drawUtils.drawXY = drawUtils.drawXZ = false; @@ -1639,11 +1635,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { else { if (y > z) { plane[1] = 1; - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { - plane[3] = stage.scrollHeight / 2.0; - } else { - plane[3] = this.getStageHeight() / 2.0; - } + plane[3] = this.getStageHeight() / 2.0; if (dir[1] > 0) plane[3] = -plane[3]; change = !drawUtils.drawXZ; 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, { // transform the bounds up the tree var child = elt; var parent = elt.offsetParent; - while ( parent ) + while ( child ) { pt = this.childToParent( pt, child ); - if (parent === this._rootElement) break; +// if (parent === this._rootElement) break; + if (child === this._stageElement) break; child = parent; parent = parent.offsetParent; @@ -352,7 +353,8 @@ exports.ViewUtils = Montage.create(Component, { // transform the bounds up the tree var parent = child.offsetParent; - if ( parent ) + // TODO - Should have a different way to check for new template mode + if ( parent || ((child === this.application.ninja.currentDocument.documentRoot) && (child.id !== "UserContent")) ) { this.setViewportObj( child ); -- cgit v1.2.3