aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/snap-manager.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-09 13:23:07 -0800
committerNivesh Rajbhandari2012-02-09 13:23:07 -0800
commit148e6f7c00e54b0ec6fa6bb6791f0ac0920af511 (patch)
tree889719cf024d73e2e1e93d73a40f96a2a8d27dc6 /js/helper-classes/3D/snap-manager.js
parenta9a02ef8a206082ea9ea0cb66f3fb70e1f4256df (diff)
parent666ae3e9119410cbf7fa974274d95336aaff091c (diff)
downloadninja-148e6f7c00e54b0ec6fa6bb6791f0ac0920af511.tar.gz
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Conflicts: js/helper-classes/RDGE/GLMaterial.js js/helper-classes/RDGE/GLRectangle.js js/helper-classes/RDGE/GLWorld.js js/helper-classes/RDGE/Materials/FlatMaterial.js js/helper-classes/RDGE/Materials/IridescentScalesMaterial.js js/helper-classes/RDGE/Materials/JuliaMaterial.js js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js js/helper-classes/RDGE/Materials/MandelMaterial.js js/helper-classes/RDGE/Materials/PlasmaMaterial.js js/helper-classes/RDGE/Materials/PulseMaterial.js js/helper-classes/RDGE/Materials/RadialBlurMaterial.js js/helper-classes/RDGE/Materials/RadialGradientMaterial.js js/helper-classes/RDGE/Materials/TunnelMaterial.js js/helper-classes/RDGE/Materials/TwistMaterial.js js/helper-classes/RDGE/rdge-compiled.js js/helper-classes/RDGE/src/core/script/renderer.js js/panels/Materials/Materials.xml Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/3D/snap-manager.js')
-rw-r--r--js/helper-classes/3D/snap-manager.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 3af7d8cf..0a950658 100644
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -970,13 +970,12 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
970 value: function( screenPt, hitRecs ) { 970 value: function( screenPt, hitRecs ) {
971 // start at the stage. 971 // start at the stage.
972 var stage = this.getStage(); 972 var stage = this.getStage();
973 //var stagePt = viewUtils.parentToChild( screenPt, stage );
974 973
975 // the root should be the 'view' canvas, so the first matrix is the camera 974 // the root should be the 'view' canvas, so the first matrix is the camera
976 viewUtils.setViewportObj( stage ); 975 viewUtils.setViewportObj( stage );
977 976
978 MathUtils.makeDimension3( screenPt ); 977 MathUtils.makeDimension3( screenPt );
979 this.hSnapToElements( stage, screenPt, hitRecs, 0, screenPt ); 978 this.hSnapToElements( stage, hitRecs, 0, screenPt );
980 979
981 return; 980 return;
982 } 981 }
@@ -984,7 +983,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
984 983
985 hSnapToElements : 984 hSnapToElements :
986 { 985 {
987 value: function( elt, parentPt, hitRecs, depth, globalScrPt ) 986 value: function( elt, hitRecs, depth, globalScrPt )
988 { 987 {
989 // hit test the current object 988 // hit test the current object
990 var hit; 989 var hit;
@@ -993,11 +992,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
993 // if the element is in the 2D cache snapping is done there 992 // if the element is in the 2D cache snapping is done there
994 if (elt.elementModel && !elt.elementModel.isIn2DSnapCache) 993 if (elt.elementModel && !elt.elementModel.isIn2DSnapCache)
995 { 994 {
996 var scrPt = viewUtils.parentToChild( parentPt, elt, false ); 995 hit = this.snapToElement( elt, globalScrPt );
997 hit = this.snapToElement( elt, scrPt, globalScrPt );
998 if (hit) 996 if (hit)
999 { 997 {
1000 //hitRecs.push( hit );
1001 if (!hit.checkType()) 998 if (!hit.checkType())
1002 { 999 {
1003 console.log( "invalid hit record: " + hit.getTypeString() ); 1000 console.log( "invalid hit record: " + hit.getTypeString() );
@@ -1016,17 +1013,14 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1016 } 1013 }
1017 // test the rest of the tree 1014 // test the rest of the tree
1018 var n = elt.childElementCount; 1015 var n = elt.childElementCount;
1019 var eltPt = viewUtils.parentToChild( parentPt, elt, true );
1020 if (n > 0) 1016 if (n > 0)
1021 { 1017 {
1022 for (var i=0; i<n; i++) 1018 for (var i=0; i<n; i++)
1023 { 1019 {
1024 var child = elt.children[i]; 1020 var child = elt.children[i];
1025 //var childPt = viewUtils.parentToChild( scrPt, child ); 1021 hit = this.hSnapToElements( child, hitRecs, (depth+1), globalScrPt );
1026 hit = this.hSnapToElements( child, eltPt, hitRecs, (depth+1), globalScrPt );
1027 if (hit) 1022 if (hit)
1028 { 1023 {
1029 //hitRecs.push( hit );
1030 if (!hit.checkType()) 1024 if (!hit.checkType())
1031 { 1025 {
1032 console.log( "invalid hit record: " + hit.getTypeString() ); 1026 console.log( "invalid hit record: " + hit.getTypeString() );
@@ -1034,7 +1028,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1034 } 1028 }
1035 else 1029 else
1036 hitRecs.push( hit ); 1030 hitRecs.push( hit );
1037
1038 } 1031 }
1039 } 1032 }
1040 } 1033 }
@@ -1043,7 +1036,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1043 1036
1044 snapToElement : 1037 snapToElement :
1045 { 1038 {
1046 value: function( elt, scrPt, globalScrPt ) 1039 value: function( elt, globalScrPt )
1047 { 1040 {
1048 if (this.isAvoidedElement(elt) ) return null; 1041 if (this.isAvoidedElement(elt) ) return null;
1049 1042