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/3D') 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 From 9eeb03e8bb86a4462609d3a18b528daa1516b91c Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 7 May 2012 13:57:18 -0700 Subject: fixes for 2D and 3D translation. --- js/helper-classes/3D/snap-manager.js | 4 ++ js/helper-classes/3D/view-utils.js | 80 ++++++++++++++++++++++++++++-------- 2 files changed, 67 insertions(+), 17 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index f4bfc12b..6766ac7f 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1957,6 +1957,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { var localPt = hitRec.getLocalPoint(); var planeMat = hitRec.getPlaneMatrix(); var stageWorldPt; + + /* if(inGlobalMode) { stageWorldPt = MathUtils.transformPoint(localPt,planeMat); @@ -1965,6 +1967,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { { stageWorldPt = viewUtils.postViewToStageWorld( MathUtils.transformPoint(localPt,planeMat), elt ); } + */ + stageWorldPt = viewUtils.postViewToStageWorld( MathUtils.transformPoint(localPt,planeMat), elt ); /* // get a working plane parallel to the current working plane through the stage world point diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 40a19b90..919f7c50 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -124,35 +124,81 @@ exports.ViewUtils = Montage.create(Component, { } }, - getNormalToUnprojectedElementPlane: { - value: function( elt ) { - var mat = this.getMatrixFromElement(elt); + /* + * This method will return a normal to a plane containing the Z axis and either the + * x or y axis of the element. + */ + getNormalToUnprojectedElementPlane: + { + value: function( elt, axis, localMode ) + { + var objMat = this.getMatrixFromElement(elt); + var objMatInv = glmat4.inverse( objMat, [] ); - var xVec = [mat[0], mat[1], mat[2], mat[3]]; - var yVec = [mat[4], mat[5], mat[6], mat[7]]; + var xVec = [1,0,0]; + var yVec = [0,1,0]; + var zVec = [0,0,1]; var stage = this.application.ninja.currentDocument.documentRoot; var stageMat = this.getMatrixFromElement(stage); - var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; + var mat = glmat4.multiply( stageMat, objMat, [] ); + + var viewDir; + if (localMode) + { + var matInv = glmat4.inverse( mat, [] ); + viewDir = MathUtils.transformVector( [0,0,1], matInv ); + } + else + { + var stageInv = glmat4.inverse( stageMat, [] ); + viewDir = MathUtils.transformVector( [0,0,1], stageInv ); + } + + /* if (elt === stage) { xVec = [1,0,0]; yVec = [0,1,0]; } + */ - var xDot = Math.abs(vecUtils.vecDot(3, xVec, stagePlane)); - var yDot = Math.abs(vecUtils.vecDot(3, yVec, stagePlane)); + var plane; + var xDot, yDot, zDot; + switch (axis) + { + case 0: + yDot = Math.abs(vecUtils.vecDot(3, yVec, viewDir)); + zDot = Math.abs(vecUtils.vecDot(3, zVec, viewDir)); + if(yDot > zDot) + plane = vecUtils.vecCross( 3, zVec, xVec ); + else + plane = vecUtils.vecCross( 3, yVec, xVec ); + break; + + case 1: + xDot = Math.abs(vecUtils.vecDot(3, yVec, viewDir)); + zDot = Math.abs(vecUtils.vecDot(3, zVec, viewDir)); + if(xDot > zDot) + plane = vecUtils.vecCross( 3, zVec, yVec ); + else + plane = vecUtils.vecCross( 3, xVec, yVec ); + break; + break; + + case 2: + xDot = Math.abs(vecUtils.vecDot(3, xVec, viewDir)); + yDot = Math.abs(vecUtils.vecDot(3, yVec, viewDir)); + + if(xDot > yDot) + plane = vecUtils.vecCross( 3, yVec, zVec ); + else + plane = vecUtils.vecCross( 3, xVec, zVec ); + break; + } - var plane; - if(xDot > yDot) - { - plane = xVec; - } - else - { - plane = yVec; - } + if (localMode) plane = MathUtils.transformVector( plane, objMat ); // The translation value is a point on the plane this.pushViewportObj( elt ); -- cgit v1.2.3 From fb71f5715a288b59d6b151c11a293e179d2c9ace Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 10 May 2012 10:04:26 -0700 Subject: Draw 3d compass at the bottom-left. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index f869f65e..f639521c 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1171,7 +1171,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var saveLineWidth = this._lineWidth; var origLeft = 50; - var origTop = 50; + var origTop = this.snapManager.getStageHeight() - 50; var mat = this.viewUtils.getMatrixFromElement( this._sourceSpaceElt ); var tMat = Matrix.Translation([origLeft,origTop,0]); @@ -1203,7 +1203,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.setDrawingSurfaceElement(this.application.ninja.stage.layoutCanvas); // clear just the 3d compass area this._drawingContext.save(); - this._drawingContext.rect(0, 0, 100, 100); + this._drawingContext.rect(0, origTop-50, 100, 100); this._drawingContext.clip(); this._drawingContext.lineWidth = 2.0; -- cgit v1.2.3 From babfa5f1ca4f702920d81d7e12a90b12ffbf42d8 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 10 May 2012 16:53:18 -0700 Subject: Fixed an inaccuracy snapping to the stage. --- js/helper-classes/3D/snap-manager.js | 139 +++++++++++++++++++---------------- js/helper-classes/3D/view-utils.js | 5 ++ 2 files changed, 81 insertions(+), 63 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 6766ac7f..27a95941 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -230,64 +230,19 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { else parentPt = [xScreen, yScreen, 0.0]; - var eyePt = []; - var vec = viewUtils.parentToChildVec(parentPt, stage, eyePt); - if (vec) - { - // activate the drag working plane - if (!snap3D && this.hasDragPlane()) - this.activateDragPlane(); - - // project to the working plane - var currentWorkingPlane = workingPlane.slice(0); - var wp = currentWorkingPlane.slice(0); - var mat = viewUtils.getMatrixFromElement(stage); - wp = MathUtils.transformPlane(wp, mat); - var projPt = MathUtils.vecIntersectPlane(eyePt, vec, wp); - if (projPt) - { - // the local point gets stored in the coordinate space of the plane - var wpMat = drawUtils.getPlaneToWorldMatrix(currentWorkingPlane, MathUtils.getPointOnPlane(currentWorkingPlane)); - projPt[3] = 1.0; - //var planeToViewMat = mat.multiply(wpMat); - var planeToViewMat = glmat4.multiply(mat, wpMat, []); - //var viewToPlaneMat = planeToViewMat.inverse(); - var viewToPlaneMat = glmat4.inverse( planeToViewMat, [] ); - var planePt = projPt.slice(0); - planePt[3] = 1.0; - //planePt = viewToPlaneMat.multiply(planePt); - planePt = glmat4.multiplyVec3( viewToPlaneMat, planePt ); - - // get the screen position of the projected point - viewUtils.setViewportObj(stage); - var offset = viewUtils.getElementOffset(stage); - offset[2] = 0; - var scrPt = viewUtils.viewToScreen(projPt); - //scrPt = scrPt.add(offset); - scrPt = vecUtils.vecAdd(3, scrPt, offset); - - // create the hit record - var hitRec = Object.create(HitRecord);//new HitRecord(); - hitRec.setLocalPoint(planePt); - hitRec.setPlaneMatrix( wpMat ); - hitRec.setScreenPoint(scrPt); - hitRec.setPlane(currentWorkingPlane); - hitRec.setType( hitRec.SNAP_TYPE_STAGE ); - hitRec.setElt( stage ); - if (quadPt) hitRec.setUseQuadPoint( true ); - - // try snapping to the 3D grid, or to the stage boundaries if the grid is not displayed - if (this.gridSnapEnabled()) - this.snapToGrid( hitRec ); - - // save the hit record - hitRecArray.push( hitRec ); - - // restore the original working plane - if (!snap3D && this.hasDragPlane()) - this.deactivateDragPlane(); - } - } + var hitRec = this.snapToStage( parentPt, quadPt ); + + // try snapping to the 3D grid, or to the stage boundaries if the grid is not displayed + if (this.gridSnapEnabled()) + this.snapToGrid( hitRec ); + + // save the hit record + hitRecArray.push( hitRec ); + + // restore the original working plane + if (!snap3D && this.hasDragPlane()) + this.deactivateDragPlane(); + } //if (hitRecArray.length == 0) var rtnHit; @@ -312,6 +267,62 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, + snapToStage: + { + value: function( scrPt, quadPt ) + { + var stage = this.getStage(); + var l2g = viewUtils.getLocalToGlobalMatrix( stage ); + var g2l = glmat4.inverse( l2g, [] ); + + var pt0 = scrPt.slice(), pt1 = scrPt.slice(); + pt0[2] = 0.0; pt1[2] = 10; + + var localPt0 = MathUtils.transformAndDivideHomogeneousPoint( pt0, g2l ), + localPt1 = MathUtils.transformAndDivideHomogeneousPoint( pt1, g2l ); + + var stageWorldPt0 = viewUtils.localToStageWorld( localPt0, stage ), + stageWorldPt1 = viewUtils.localToStageWorld( localPt1, stage ); + var vec = vecUtils.vecSubtract( 3, stageWorldPt1, stageWorldPt0 ); + + var ptOnWorkingPlane = MathUtils.vecIntersectPlane(stageWorldPt0, vec, workingPlane); + + var wpMat = drawUtils.getPlaneToWorldMatrix(workingPlane, MathUtils.getPointOnPlane(workingPlane)), + wpMatInv = glmat4.inverse( wpMat, [] ); + var localPt = MathUtils.transformPoint( ptOnWorkingPlane, wpMatInv ); + + // create the hit record + var hitRec = Object.create(HitRecord); + hitRec.setLocalPoint( localPt ); + hitRec.setPlaneMatrix( wpMat ); + hitRec.setScreenPoint(scrPt); + hitRec.setPlane(workingPlane); + hitRec.setType( hitRec.SNAP_TYPE_STAGE ); + hitRec.setElt( stage ); + if (quadPt) hitRec.setUseQuadPoint( true ); + + // DEBUG CODE + // check that the point is on the working plane + var tmpStageWorldPt = hitRec.calculateStageWorldPoint(); + var err = vecUtils.vecDot(3, tmpStageWorldPt, workingPlane) + workingPlane[3]; + if (MathUtils.fpSign(err) !== 0) + console.log( "snapToStage (function) not on working plane: " + err ); + ////////////////////////////////////////////////////////////////////// + + var calculatedScreenPt = hitRec.calculateScreenPoint(); + hitRec.setScreenPoint(calculatedScreenPt); + + // DEBUG CODE + // check that the point is on the working plane + var err2 = vecUtils.vecDist(2, calculatedScreenPt, scrPt ); + if (MathUtils.fpSign(err2) !== 0) + console.log( "snapToStage (function) error in screen point: " + err2 ); + ////////////////////////////////////////////////////////////////////// + + return hitRec; + } + }, + snapToGrid : { value: function( hitRec ) { @@ -481,7 +492,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { this._elementCache = null; } - //console.log( "clear 2D cache" ); + console.log( "clear 2D cache" ); } }, @@ -494,7 +505,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { this.hLoadElementCache( stage, plane, 0 ); this._isCacheInvalid = false; - //console.log( "2D cache loaded with " + this._elementCache.length + " elements" ); + console.log( "2D cache loaded with " + this._elementCache.length + " elements" ); } }, @@ -1779,7 +1790,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (hSnap && vSnap) { - //console.log( "\tmerge 1" ); + console.log( "\tmerge 1" ); // intersect the 2 lines on the plane var hPt = hSnap.getLocalPoint(), @@ -1828,7 +1839,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (hSnap && vSnap) { - //console.log( "\tmerge 2" ); + console.log( "\tmerge 2" ); // intersect the 2 lines on the plane var hPt = hSnap.getLocalPoint(), @@ -1881,7 +1892,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (hSnap && vSnap) { - //console.log( "merge edge" ); + console.log( "merge edge" ); var hPt = hSnap.getLocalPoint(), vPt = vSnap.getLocalPoint(); @@ -1945,6 +1956,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { //this._globalToStageWorldMat = this._stageWorldToGlobalMat.inverse(); this._globalToStageWorldMat = glmat4.inverse( this._stageWorldToGlobalMat, [] ); + console.log( "setupDragPlane: " + this._dragPlane ); + // load the 2D elements this.load2DCache( this._dragPlane ); } diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 919f7c50..48d4cacf 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -288,6 +288,11 @@ exports.ViewUtils = Montage.create(Component, { value: function( localPt, elt ) { this.pushViewportObj( elt ); var viewPt = this.screenToView( localPt[0], localPt[1], localPt[2] ); + if ((elt == null) || (elt === this._stageElement)) + { + this.popViewportObj(); + return viewPt; + } var mat = this.getMatrixFromElement( elt ); var worldPt = MathUtils.transformPoint( viewPt, mat ); var stageWorldPt = this.postViewToStageWorld( worldPt, elt ); -- cgit v1.2.3 From 597fd83bf02d36240538a239d36ae77efdaf83bb Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 11 May 2012 10:10:37 -0700 Subject: Adjusting 3d compass's drawing location so it's not hitting the edge of the frame. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index f639521c..b53ac4ad 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -1170,8 +1170,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { var saveColor = this._lineColor; var saveLineWidth = this._lineWidth; - var origLeft = 50; - var origTop = this.snapManager.getStageHeight() - 50; + var origLeft = 60; + var origTop = this.snapManager.getStageHeight() - 60; var mat = this.viewUtils.getMatrixFromElement( this._sourceSpaceElt ); var tMat = Matrix.Translation([origLeft,origTop,0]); @@ -1203,7 +1203,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.setDrawingSurfaceElement(this.application.ninja.stage.layoutCanvas); // clear just the 3d compass area this._drawingContext.save(); - this._drawingContext.rect(0, origTop-50, 100, 100); + this._drawingContext.rect(10, origTop-60, 100, 110); this._drawingContext.clip(); this._drawingContext.lineWidth = 2.0; -- cgit v1.2.3 From 6abfeed78ddae26f04531cddbcb560451891c412 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 11 May 2012 10:59:59 -0700 Subject: Checked/Unchecked 'Use WebGL' checkbox in PI throws error in view-utils.. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/view-utils.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 5dc099ee..6da6de0e 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -359,11 +359,9 @@ exports.ViewUtils = Montage.create(Component, { { pt = this.childToParent( pt, child ); -// if (parent === this._rootElement) break; if (child === this._stageElement) break; child = parent; - parent = parent.offsetParent; } ///////////////////////////////////////////////////////// -- cgit v1.2.3 From 0fc470ad85e435ff6e66f05d9de1cad2b2ff91c8 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 11 May 2012 13:31:23 -0700 Subject: Fixing drawing in nested divs. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/view-utils.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 6da6de0e..22446403 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -354,14 +354,13 @@ exports.ViewUtils = Montage.create(Component, { // transform the bounds up the tree var child = elt; - var parent = elt.offsetParent; while ( child ) { pt = this.childToParent( pt, child ); if (child === this._stageElement) break; - child = parent; + child = child.offsetParent; } ///////////////////////////////////////////////////////// -- cgit v1.2.3 From 753765b604c954cea782d129e4ddd6a0ff42b2b9 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 14 May 2012 09:22:00 -0700 Subject: removed some console output. --- js/helper-classes/3D/snap-manager.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 346ad014..99ef5006 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -492,7 +492,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { this._elementCache = null; } - console.log( "clear 2D cache" ); + //console.log( "clear 2D cache" ); } }, @@ -505,7 +505,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { this.hLoadElementCache( stage, plane, 0 ); this._isCacheInvalid = false; - console.log( "2D cache loaded with " + this._elementCache.length + " elements" ); + //console.log( "2D cache loaded with " + this._elementCache.length + " elements" ); } }, @@ -1956,7 +1956,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { //this._globalToStageWorldMat = this._stageWorldToGlobalMat.inverse(); this._globalToStageWorldMat = glmat4.inverse( this._stageWorldToGlobalMat, [] ); - console.log( "setupDragPlane: " + this._dragPlane ); + //console.log( "setupDragPlane: " + this._dragPlane ); // load the 2D elements this.load2DCache( this._dragPlane ); -- cgit v1.2.3 From 734b6ad96d25bb67d0db4a0a75c331468e194809 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 14 May 2012 12:05:41 -0700 Subject: Fixing 3d to work in banner templates. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/view-utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 22446403..8c338f84 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -358,9 +358,13 @@ exports.ViewUtils = Montage.create(Component, { { pt = this.childToParent( pt, child ); - if (child === this._stageElement) break; +// if (child === this._stageElement) break; +// child = child.offsetParent; + if (child === this._stageElement) break; + if (child === this._rootElement) break; child = child.offsetParent; + if (child === this._rootElement) break; } ///////////////////////////////////////////////////////// -- cgit v1.2.3 From 904c7bfb65bb04400a0f63af1156cd9341958935 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 14 May 2012 15:11:22 -0700 Subject: Drag plane not being set. Injection from a recent checkin of mine. --- js/helper-classes/3D/snap-manager.js | 3 +++ js/helper-classes/3D/view-utils.js | 8 -------- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 99ef5006..9bbbcf29 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -230,6 +230,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { else parentPt = [xScreen, yScreen, 0.0]; + if (!snap3D && this._hasDragPlane) + this.activateDragPlane(); + var hitRec = this.snapToStage( parentPt, quadPt ); // try snapping to the 3D grid, or to the stage boundaries if the grid is not displayed diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 48d4cacf..00124900 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -156,14 +156,6 @@ exports.ViewUtils = Montage.create(Component, { viewDir = MathUtils.transformVector( [0,0,1], stageInv ); } - /* - if (elt === stage) - { - xVec = [1,0,0]; - yVec = [0,1,0]; - } - */ - var plane; var xDot, yDot, zDot; switch (axis) -- cgit v1.2.3 From 00a2452d8158fdab00eec4bd5891b753c0b0ccf5 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 14 May 2012 15:58:39 -0700 Subject: removed console output. --- js/helper-classes/3D/snap-manager.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 9bbbcf29..97901d50 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1793,7 +1793,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (hSnap && vSnap) { - console.log( "\tmerge 1" ); + //console.log( "\tmerge 1" ); // intersect the 2 lines on the plane var hPt = hSnap.getLocalPoint(), @@ -1842,7 +1842,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (hSnap && vSnap) { - console.log( "\tmerge 2" ); + //console.log( "\tmerge 2" ); // intersect the 2 lines on the plane var hPt = hSnap.getLocalPoint(), @@ -1895,7 +1895,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (hSnap && vSnap) { - console.log( "merge edge" ); + //console.log( "merge edge" ); var hPt = hSnap.getLocalPoint(), vPt = vSnap.getLocalPoint(); @@ -2052,7 +2052,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { var z = s0[2]; var typeStr = hitRec.getTypeString(); - console.log( "\ttype: " + typeStr + ", screen point z: " + hitRec.getScreenPoint()[2] + ", calculated z: " + z ); + //console.log( "\ttype: " + typeStr + ", screen point z: " + hitRec.getScreenPoint()[2] + ", calculated z: " + z ); } } } -- cgit v1.2.3 From 4f46850b376b2d428a3d9415b1dc69b36b875a2c Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 16 May 2012 13:06:34 -0700 Subject: Automatically add scrollbars when moving content to negative space. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 41 ++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index b53ac4ad..b268b8f0 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -245,16 +245,45 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { } var els = event.detail.data.els; if(els && this._shouldUpdatePlanes(event.detail.data.prop)) { - var len = els.length; + var len = els.length, + stage = this.application.ninja.stage, + minLeft = stage.userPaddingLeft, + minTop = stage.userPaddingTop, + docLeft = stage.documentOffsetLeft, + docTop = stage.documentOffsetTop, + l, + t, + plane, + changed = false; for(var i=0; i < len; i++) { - if(els[i].elementModel.props3D.elementPlane) { - els[i].elementModel.props3D.elementPlane.init(); + plane = els[i].elementModel.props3D.elementPlane; + if(plane) { + plane.init(); + l = plane._rect.m_left - docLeft; + t = plane._rect.m_top - docTop; + if(l < minLeft) { + minLeft = l; + } + if(t < minTop) { + minTop = t; + } } } - this.application.ninja.stage.layout.draw(); - this.drawWorkingPlane(); - this.draw3DCompass(); + if(minLeft !== stage.userPaddingLeft) { + stage.userPaddingLeft = minLeft; + changed = true; + } + if(minTop !== stage.userPaddingTop) { + stage.userPaddingTop = minTop; + changed = true; + } + + if(!changed) { + stage.layout.draw(); + this.drawWorkingPlane(); + this.draw3DCompass(); + } } } }, -- cgit v1.2.3 From fd54dabad7cbc27a0efb0957155c00d578912909 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 16 May 2012 15:32:36 -0700 Subject: changing @change to propertyChangeListener Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/snap-manager.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 5a36e367..2e8020d3 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -130,10 +130,10 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { bindSnap: { value: function() { - this.addEventListener("change@appModel.snap", this.toggleSnap, false); - this.addEventListener("change@appModel.snapGrid", this.toggleSnapGrid, false); - this.addEventListener("change@appModel.snapObjects", this.toggleSnapObjects, false); - this.addEventListener("change@appModel.snapAlign", this.toggleSnapAlign, false); + this.addPropertyChangeListener("appModel.snap", this.toggleSnap, false); + this.addPropertyChangeListener("appModel.snapGrid", this.toggleSnapGrid, false); + this.addPropertyChangeListener("appModel.snapObjects", this.toggleSnapObjects, false); + this.addPropertyChangeListener("appModel.snapAlign", this.toggleSnapAlign, false); } }, -- cgit v1.2.3 From 727ad95f6828821f0682aa98104783e4bbda78b4 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 16 May 2012 15:56:54 -0700 Subject: Inline style for html's padding for content in negative space to guarantee highest specificity. Also, set up scrollbars when opening files with content in negative space. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index b268b8f0..a6d2d899 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -119,19 +119,43 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { initializeFromDocument:{ value:function(){ - var documentRootChildren = null, i; + var documentRootChildren = null, i, stage = this.application.ninja.stage; //initialize with current document this._eltArray = []; this._planesArray = []; - this.setDrawingSurfaceElement(this.application.ninja.stage.canvas); - this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage ); + this.setDrawingSurfaceElement(stage.canvas); + this.setSourceSpaceElement( stage.stageDeps.currentStage ); this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them if(this.application.ninja.currentDocument._liveNodeList.length > 0){ documentRootChildren = this.application.ninja.currentDocument._liveNodeList; - for(i=0;i --- js/helper-classes/3D/draw-utils.js | 2 +- js/helper-classes/3D/snap-manager.js | 13 ++------- js/helper-classes/3D/view-utils.js | 53 ++++++++++++++---------------------- 3 files changed, 24 insertions(+), 44 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index a6d2d899..a8bc16ef 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -138,7 +138,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { l, t, plane, - elt + elt; for(i=0; i --- js/helper-classes/3D/draw-utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index a8bc16ef..bf48a723 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -124,7 +124,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._eltArray = []; this._planesArray = []; this.setDrawingSurfaceElement(stage.canvas); - this.setSourceSpaceElement( stage.stageDeps.currentStage ); + this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them -- cgit v1.2.3 From 084bb924bc3c3a6ad1e2e21099399bba4d473fed Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 00:41:31 -0700 Subject: fixing some snapping bugs Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/snap-manager.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 7194524e..e22ac3ad 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -456,6 +456,13 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { } }, + reload2DCache: { + value: function() { + this.clear2DCache(); + this.load2DCache(workingPlane); + } + }, + clear2DCache : { value : function() { // clear the 2D cache flags in the objects -- cgit v1.2.3 From 66edf78c7e5df11218ef733686965beab05c7c7d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 18 May 2012 14:01:00 -0700 Subject: fixing a scrolling issue when multiple documents are switched Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/view-utils.js | 9 --------- 1 file changed, 9 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 20f61be1..75530af3 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -1303,15 +1303,6 @@ exports.ViewUtils = Montage.create(Component, { // MISCELLANEOUS // event.layerX/Y: var pt = viewUtils.getMousePoint(event); - getStageDimension: { - value: function() - { - var width = parseInt(this.application.ninja.stage.documentRoot.elementModel.stageDimension.style.getProperty("width")); - var height= parseInt(this.application.ninja.stage.documentRoot.elementModel.stageDimension.style.getProperty("height")); - return[width,height]; - } - }, - getStage: { value: function() { -- cgit v1.2.3 From f97590388467b5a3316f6f155162fc293915fddc Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 23 May 2012 16:09:22 -0700 Subject: Fixed scrolling and centering stage code. Also, moved liveNodeList into the design view and added an option to exclude styles and text nodes when retrieving the live nodes. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/draw-utils.js | 19 +++++++++++-------- js/helper-classes/3D/view-utils.js | 13 +++---------- 2 files changed, 14 insertions(+), 18 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index bf48a723..79be5c14 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -119,7 +119,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { initializeFromDocument:{ value:function(){ - var documentRootChildren = null, i, stage = this.application.ninja.stage; + var i, + documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true), + stage = this.application.ninja.stage, + len = documentRootChildren.length; //initialize with current document this._eltArray = []; this._planesArray = []; @@ -128,11 +131,11 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them - if(this.application.ninja.currentDocument._liveNodeList.length > 0){ - documentRootChildren = this.application.ninja.currentDocument._liveNodeList; - var len = documentRootChildren.length, - minLeft = stage.userPaddingLeft, - minTop = stage.userPaddingTop, + if(len > 0) { + var initL = 0, + initT = 0, + minLeft = 0, + minTop = 0, docLeft = stage.documentOffsetLeft, docTop = stage.documentOffsetTop, l, @@ -151,10 +154,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { minTop = t; } } - if(minLeft !== stage.userPaddingLeft) { + if(minLeft !== initL) { stage.userPaddingLeft = minLeft; } - if(minTop !== stage.userPaddingTop) { + if(minTop !== initT) { stage.userPaddingTop = minTop; } } diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 0080bf90..24b30298 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -24,9 +24,6 @@ exports.ViewUtils = Montage.create(Component, { // keep a stack of viewport objects _viewportObjStack: { value: []}, - _userContentLeft: { value: null}, - _userContentTop: { value: null}, - /////////////////////////////////////////////////////////////////////// // Property accessors /////////////////////////////////////////////////////////////////////// @@ -39,9 +36,6 @@ exports.ViewUtils = Montage.create(Component, { }, getViewportObj: { value: function() { return this.m_viewportObj; } }, - setUserContentLeft: { value: function(value) { this._userContentLeft = value; }}, - setUserContentTop: { value: function(value) { this._userContentTop = value; }}, - getPerspectiveDistance: { value: function () { return this._perspectiveDist; } }, /////////////////////////////////////////////////////////////////////// @@ -385,7 +379,7 @@ exports.ViewUtils = Montage.create(Component, { // transform the bounds up the tree var parent = child.offsetParent; // TODO - Should have a different way to check for new template mode - if ( parent || ((child === this.application.ninja.currentDocument.documentRoot) && (child.id !== "UserContent")) ) + if ( parent || (child === this.application.ninja.currentDocument.documentRoot) ) { this.setViewportObj( child ); @@ -703,8 +697,8 @@ exports.ViewUtils = Montage.create(Component, { { // TODO - Call a routine from the user document controller to get the offsets/margins // Once we expose the document controller to ViewUtils - offset[0] += this._userContentLeft; - offset[1] += this._userContentTop; + offset[0] += this.application.ninja.stage._userContentLeft; + offset[1] += this.application.ninja.stage._userContentTop; } return offset; @@ -1282,7 +1276,6 @@ exports.ViewUtils = Montage.create(Component, { // stageManager._canvas: this.application.ninja.stage.canvas // stageManager.layoutCanvas: this.application.ninja.stage.layoutCanvas // stageManager.drawingCanvas: this.application.ninja.stage.drawingCanvas -// stageManager.userContentLeft this.application.ninja.stage.userContentLeft // viewUtils: stage.viewUtils; // snapManager stage.snapManager; // -- cgit v1.2.3 From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: Cleaning up referencing to 'documentRoot' and '_document' Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view. --- js/helper-classes/3D/draw-utils.js | 12 +++++----- js/helper-classes/3D/snap-manager.js | 6 ++--- js/helper-classes/3D/view-utils.js | 44 ++++++++++++++++++------------------ 3 files changed, 31 insertions(+), 31 deletions(-) (limited to 'js/helper-classes/3D') diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index bf48a723..9de85216 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -124,7 +124,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._eltArray = []; this._planesArray = []; this.setDrawingSurfaceElement(stage.canvas); - this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); + this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); this.setWorkingPlane( [0,0,1,0] ); //Loop through all the top-level children of the current document and call drawUtils.addElement on them @@ -697,7 +697,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this._lineColor = saveColor; this._drawingContext.lineWidth = saveLineWidth; - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { // draw an outline around the body var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); @@ -815,7 +815,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // draw the lines var line, nLines = this._gridLineArray.length; - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { nLines = this._gridLineArray.length-4; } @@ -824,7 +824,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.drawIntersectedLine(line, this._drawingContext); } - if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { + if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { this._lineColor = "red"; i = nLines; nLines += 4; @@ -923,7 +923,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { // if all of the planes are aligned, check if they are aligned with the view direction if (flat) { - var stage = this.application.ninja.currentDocument.documentRoot; + var stage = this.application.ninja.currentDocument.model.documentRoot; var stageMat = this.viewUtils.getMatrixFromElement(stage); var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; viewDir = vecUtils.vecNormalize( 3, viewDir ); @@ -1213,7 +1213,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { value: function() { // set the element to be the viewport object - temporarily var tmpCanvas = this.application.ninja.stage.canvas; - var tmpStage = this.application.ninja.currentDocument.documentRoot; + var tmpStage = this.application.ninja.currentDocument.model.documentRoot; this.viewUtils.pushViewportObj( tmpCanvas ); // save the source space object and set to the target object diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 0f456e1e..d937e897 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -83,14 +83,14 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }}, getStageWidth : { value: function () { - return parseInt(this.application.ninja.currentDocument.documentRoot.offsetWidth); + return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetWidth); }}, getStageHeight : { value: function () { - return parseInt(this.application.ninja.currentDocument.documentRoot.offsetHeight); + return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetHeight); }}, - getStage : { value: function() { return this.application.ninja.currentDocument.documentRoot; }}, + getStage : { value: function() { return this.application.ninja.currentDocument.model.documentRoot; }}, getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }}, getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }}, diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 0080bf90..f5ab7172 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -126,7 +126,7 @@ exports.ViewUtils = Montage.create(Component, { var yVec = [0,1,0]; var zVec = [0,0,1]; - var stage = this.application.ninja.currentDocument.documentRoot; + var stage = this.application.ninja.currentDocument.model.documentRoot; var stageMat = this.getMatrixFromElement(stage); var mat = glmat4.multiply( stageMat, objMat, [] ); @@ -286,7 +286,7 @@ exports.ViewUtils = Montage.create(Component, { // into stage world space. postViewToStageWorld: { value: function( localPt, elt ) { - if ((elt == null) || (elt === this.application.ninja.currentDocument.documentRoot)) return localPt; + if ((elt == null) || (elt === this.application.ninja.currentDocument.model.documentRoot)) return localPt; // get the 3D transformation and 2D offset from the element var pt = localPt.slice(0); @@ -313,7 +313,7 @@ exports.ViewUtils = Montage.create(Component, { this.popViewportObj(); // check if we are done - if (parent === this.application.ninja.currentDocument.documentRoot) break; + if (parent === this.application.ninja.currentDocument.model.documentRoot) break; if (this.elementHas3D( parent )) { @@ -342,13 +342,13 @@ exports.ViewUtils = Montage.create(Component, { { pt = this.childToParent( pt, child ); -// if (child === this.application.ninja.currentDocument.documentRoot) break; +// if (child === this.application.ninja.currentDocument.model.documentRoot) break; // child = child.offsetParent; - if (child === this.application.ninja.currentDocument.documentRoot) break; - if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (child === this.application.ninja.currentDocument.model.documentRoot) break; + if (child === this.application.ninja.currentDocument.model.documentRoot.parentNode) break; child = child.offsetParent; - if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break; + if (child === this.application.ninja.currentDocument.model.documentRoot.parentNode) break; } ///////////////////////////////////////////////////////// @@ -385,7 +385,7 @@ exports.ViewUtils = Montage.create(Component, { // transform the bounds up the tree var parent = child.offsetParent; // TODO - Should have a different way to check for new template mode - if ( parent || ((child === this.application.ninja.currentDocument.documentRoot) && (child.id !== "UserContent")) ) + if ( parent || ((child === this.application.ninja.currentDocument.model.documentRoot) && (child.id !== "UserContent")) ) { this.setViewportObj( child ); @@ -398,7 +398,7 @@ exports.ViewUtils = Montage.create(Component, { { // TODO - Commenting out flatten support until new perspective workflow is fully working // if (flatten) pt[2] = 0; -// var flatten = (parent !== this.application.ninja.currentDocument.documentRoot.parentNode) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d"); +// var flatten = (parent !== this.application.ninja.currentDocument.model.documentRoot.parentNode) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d"); // if(flatten) // { // pt[2] = 0; @@ -458,7 +458,7 @@ exports.ViewUtils = Montag