aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D
diff options
context:
space:
mode:
authorAnanya Sen2012-02-23 13:43:35 -0800
committerAnanya Sen2012-02-23 13:43:35 -0800
commit7283884c39df537694b21419a3ea9e3ca7793b4b (patch)
treebd48aebcfdb2ba36721360a47c1654f22b9f75b6 /js/helper-classes/3D
parentdbf0ca5637a3bca87c21c65ada47f8a4d794f78c (diff)
downloadninja-7283884c39df537694b21419a3ea9e3ca7793b4b.tar.gz
switch html document - re-initialize draw-utils and snap-manager on opening a document and while switching documents
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/helper-classes/3D')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js20
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js1
2 files changed, 21 insertions, 0 deletions
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, {
115 } 115 }
116 }, 116 },
117 117
118 initializeFromDocument:{
119 value:function(){
120 var documentRootChildren = null, i;
121 //initialize with current document
122 this._eltArray = [];
123 this._planesArray = [];
124 this.setDrawingSurfaceElement(this.application.ninja.stage.canvas);
125 this.setSourceSpaceElement( this.application.ninja.stage.stageDeps.currentStage );
126 this.setWorkingPlane( Vector.create( [0,0,1,0] ) );
127
128 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
129 if(this.application.ninja.currentDocument.documentRoot.hasChildNodes()){
130 documentRootChildren = this.application.ninja.currentDocument.documentRoot.childNodes;
131 for(i=0;i<documentRootChildren.length;i++){
132 this.addElement(documentRootChildren[i]);
133 }
134 }
135 }
136 },
137
118 handleElementAdded: { 138 handleElementAdded: {
119 value: function(event) { 139 value: function(event) {
120 this.addElement(event.detail); 140 this.addElement(event.detail);
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 0a950658..45a178ce 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, {
1087 1087
1088 // we need to check the orientation of the bounds 1088 // we need to check the orientation of the bounds
1089 var nrm = MathUtils.getNormalFromBounds3D( bounds3D ); 1089 var nrm = MathUtils.getNormalFromBounds3D( bounds3D );
1090 if (MathUtils.fpSign(nrm[2]) == 0) return null;
1090 var zNrm = nrm[2]; 1091 var zNrm = nrm[2];
1091 var dist; 1092 var dist;
1092 1093