aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/snap-manager.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/3D/snap-manager.js')
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js19
1 files changed, 6 insertions, 13 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 61f5bc97..cd8cc102 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -306,6 +306,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
306 this.deactivateDragPlane(); 306 this.deactivateDragPlane();
307 307
308 this.setLastHit( rtnHit ); 308 this.setLastHit( rtnHit );
309
310 //rtnHit.test(); // DEBUG CODE. REMOVE THIS
309 return rtnHit; 311 return rtnHit;
310 } 312 }
311 }, 313 },
@@ -1086,15 +1088,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1086 localPt = MathUtils.transformPoint( localPt, inv ); 1088 localPt = MathUtils.transformPoint( localPt, inv );
1087 var hitContained = false; 1089 var hitContained = false;
1088 hitContained = this.snapToContainedElements( hitRec, localPt, globalScrPt ); 1090 hitContained = this.snapToContainedElements( hitRec, localPt, globalScrPt );
1089
1090 // disable snapping to element bounds when the object isnot selected
1091 if (!hitContained && !this.application.ninja.selectionController.isObjectSelected(elt))
1092 {
1093 if ((hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT_EDGE) ||
1094 (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT_VERTEX) ||
1095 (hitRec.getType() == hitRec.SNAP_TYPE_ELEMENT))
1096 hitRec = null;
1097 }
1098 } 1091 }
1099 1092
1100 return hitRec; 1093 return hitRec;
@@ -1354,7 +1347,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1354 var offset = viewUtils.getElementOffset( elt ); 1347 var offset = viewUtils.getElementOffset( elt );
1355 MathUtils.makeDimension3( offset ); 1348 MathUtils.makeDimension3( offset );
1356 var parentPt = vecUtils.vecAdd(3, scrPt, offset ); 1349 var parentPt = vecUtils.vecAdd(3, scrPt, offset );
1357 var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); 1350 var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent );
1358 1351
1359 var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); 1352 var dist = vecUtils.vecDist(2, globalPt, targetScrPt );
1360 if (dist < this.ELEMENT_VERTEX_HIT_RAD) 1353 if (dist < this.ELEMENT_VERTEX_HIT_RAD)
@@ -1392,7 +1385,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1392 var offset = viewUtils.getElementOffset( elt ); 1385 var offset = viewUtils.getElementOffset( elt );
1393 MathUtils.makeDimension3( offset ); 1386 MathUtils.makeDimension3( offset );
1394 var parentPt = vecUtils.vecAdd(3, scrPt, offset ); 1387 var parentPt = vecUtils.vecAdd(3, scrPt, offset );
1395 var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); 1388 var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent );
1396 1389
1397 var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); 1390 var dist = vecUtils.vecDist(2, globalPt, targetScrPt );
1398 if (dist < this.ELEMENT_EDGE_HIT_RAD) 1391 if (dist < this.ELEMENT_EDGE_HIT_RAD)
@@ -1445,7 +1438,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1445 var offset = viewUtils.getElementOffset( elt ); 1438 var offset = viewUtils.getElementOffset( elt );
1446 MathUtils.makeDimension3( offset ); 1439 MathUtils.makeDimension3( offset );
1447 var parentPt = vecUtils.vecAdd(3, scrPt, offset ); 1440 var parentPt = vecUtils.vecAdd(3, scrPt, offset );
1448 var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); 1441 var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent );
1449 1442
1450 var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); 1443 var dist = vecUtils.vecDist(2, globalPt, targetScrPt );
1451 if (dist < this.ELEMENT_VERTEX_HIT_RAD) 1444 if (dist < this.ELEMENT_VERTEX_HIT_RAD)
@@ -1483,7 +1476,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1483 var offset = viewUtils.getElementOffset( elt ); 1476 var offset = viewUtils.getElementOffset( elt );
1484 MathUtils.makeDimension3( offset ); 1477 MathUtils.makeDimension3( offset );
1485 var parentPt = vecUtils.vecAdd(3, scrPt, offset ); 1478 var parentPt = vecUtils.vecAdd(3, scrPt, offset );
1486 var globalPt = viewUtils.localToGlobal( parentPt, elt.parentElement ); 1479 var globalPt = viewUtils.localToGlobal( parentPt, elt.offsetParent );
1487 1480
1488 var dist = vecUtils.vecDist(2, globalPt, targetScrPt ); 1481 var dist = vecUtils.vecDist(2, globalPt, targetScrPt );
1489 if (dist < this.ELEMENT_EDGE_HIT_RAD) 1482 if (dist < this.ELEMENT_EDGE_HIT_RAD)