From 96bfeee2e6b735b87e8482d6e2cf24d5224c6417 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Thu, 5 Apr 2012 17:03:14 -0700 Subject: translate3DObject tool fixes. --- js/helper-classes/3D/view-utils.js | 45 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'js/helper-classes/3D/view-utils.js') diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index a72b7906..392de0be 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -112,6 +112,13 @@ exports.ViewUtils = Montage.create(Component, { var mat = this.getMatrixFromElement(elt); var plane = [mat[8], mat[9], mat[10], mat[11]]; + var stage = this.application.ninja.currentDocument.documentRoot; + if (elt === stage) + { + xVec = [1,0,0]; + yVec = [0,1,0]; + } + // The translation value is a point on the plane this.pushViewportObj( elt ); var ptOnPlane = this.getCenterOfProjection(); @@ -137,6 +144,12 @@ exports.ViewUtils = Montage.create(Component, { var stageMat = this.getMatrixFromElement(stage); var stagePlane = [stageMat[8], stageMat[9], stageMat[10], stageMat[11]]; + 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)); @@ -788,35 +801,23 @@ exports.ViewUtils = Montage.create(Component, { } }, - getStageWorldToGlobalMatrix: { - value: function() { + getStageWorldToGlobalMatrix: + { + value: function() + { var stage = this.application.ninja.currentDocument.documentRoot; this.pushViewportObj( stage ); - - // get the matrix to the parent - var mat = Matrix.I(4); - //var projMat = Matrix.I(4).multiply( this.getPerspectiveDistFromElement(stage) ); - var p = this.getPerspectiveDistFromElement(stage); - var projMat = glmat4.scale( Matrix.I(4), [p,p,p], [] ); - projMat[11] = -1; + + // put the point into screen space of the stage - requires + // a translation to the top/left only var cop = this.getCenterOfProjection(); var v2s = Matrix.Translation([cop[0], cop[1], 0]); - //mat = v2s.multiply( projMat ); - mat = glmat4.multiply( v2s, projMat, [] ); - - // offset to the parent - var offset = this.getElementOffset( stage ); - var offMat = Matrix.Translation([offset[0], offset[1], 0]); - //mat = offMat.multiply( mat ); - glmat4.multiply( offMat, mat, mat ); - this.popViewportObj(); - // var mat2 = this.getLocalToGlobalMatrix( stage.parentElement ); - var mat2 = this.getLocalToGlobalMatrix( this._rootElement ); - //var mat = mat2.multiply( mat ); - glmat4.multiply( mat2, mat, mat ); + // append the localToGlobal matrix of the stage. + var mat = this.getLocalToGlobalMatrix( stage ); + glmat4.multiply( mat, v2s ); return mat; } -- cgit v1.2.3 From 521df0ed9242efff45715998837068c87aca7efd Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 13 Apr 2012 11:12:40 -0700 Subject: 3D Rotate changes --- js/helper-classes/3D/view-utils.js | 7 ------- 1 file changed, 7 deletions(-) (limited to 'js/helper-classes/3D/view-utils.js') diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index 392de0be..f803a274 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -112,13 +112,6 @@ exports.ViewUtils = Montage.create(Component, { var mat = this.getMatrixFromElement(elt); var plane = [mat[8], mat[9], mat[10], mat[11]]; - var stage = this.application.ninja.currentDocument.documentRoot; - if (elt === stage) - { - xVec = [1,0,0]; - yVec = [0,1,0]; - } - // The translation value is a point on the plane this.pushViewportObj( elt ); var ptOnPlane = this.getCenterOfProjection(); -- cgit v1.2.3