From 9d3589feb0174c09d1c1bac405660f8900259c7d Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 22 Feb 2012 04:44:07 -0800 Subject: Adding bug fixes. --- js/helper-classes/3D/snap-manager.js | 1 + js/helper-classes/3D/view-utils.js | 8 ++++++++ 2 files changed, 9 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 0a950658..ada6960b 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -1087,6 +1087,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { // we need to check the orientation of the bounds var nrm = MathUtils.getNormalFromBounds3D( bounds3D ); + if (MathUtils.fpSign(nrm[2]) == 0) return null; var zNrm = nrm[2]; var dist; diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js index a2fac34f..bedda8bf 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js @@ -1226,6 +1226,14 @@ exports.ViewUtils = Montage.create(Component, { } }, + getCurrentDocument: + { + value: function() + { + return snapManagerModule.SnapManager.application.ninja.currentDocument; + } + }, + setStageZoom: { value:function( globalPt, zoomFactor ) { var localPt; -- cgit v1.2.3 From aaa8d05cc3cfd94322d356e265b94b0abb9f6305 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 23 Feb 2012 01:52:34 -0800 Subject: renaming makeElementModel2 to makeModelFromElement Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/snap-manager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 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 0a950658..2922edf9 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -521,7 +521,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (!elt.elementModel) { - NJUtils.makeElementModel2(elt); + NJUtils.makeModelFromElement(elt); } elt.elementModel.isIn2DSnapCache = true; } @@ -588,7 +588,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (!elt.elementModel) { - NJUtils.makeElementModel2(elt); + NJUtils.makeModelFromElement(elt); } elt.elementModel.isIn2DSnapCache = true; } -- cgit v1.2.3 From 7283884c39df537694b21419a3ea9e3ca7793b4b Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 23 Feb 2012 13:43:35 -0800 Subject: switch html document - re-initialize draw-utils and snap-manager on opening a document and while switching documents Signed-off-by: Ananya Sen --- js/helper-classes/3D/draw-utils.js | 20 ++++++++++++++++++++ js/helper-classes/3D/snap-manager.js | 1 + 2 files changed, 21 insertions(+) (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 c07391db..37fc1cfc 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -115,6 +115,26 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { } }, + initializeFromDocument:{ + value:function(){ + var documentRootChildren = null, i; + //initialize with current document + this._eltArray = []; + this._planesArray = []; + this.setDrawingSurfaceElement(this.application.ninja.stage.canvas); + this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage ); + this.setWorkingPlane( Vector.create( [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.documentRoot.hasChildNodes()){ + documentRootChildren = this.application.ninja.currentDocument.documentRoot.childNodes; + for(i=0;i --- 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 37fc1cfc..85870097 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js @@ -126,8 +126,8 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { this.setWorkingPlane( Vector.create( [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.documentRoot.hasChildNodes()){ - documentRootChildren = this.application.ninja.currentDocument.documentRoot.childNodes; + if(this.application.ninja.currentDocument._liveNodeList.length > 0){ + documentRootChildren = this.application.ninja.currentDocument._liveNodeList; for(i=0;i