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.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index a401c363..61f5bc97 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -229,7 +229,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
229 parentPt = [quadPt[0], quadPt[1], 0.0]; 229 parentPt = [quadPt[0], quadPt[1], 0.0];
230 else 230 else
231 parentPt = [xScreen, yScreen, 0.0]; 231 parentPt = [xScreen, yScreen, 0.0];
232 var vec = viewUtils.parentToChildVec(parentPt, stage); 232
233 var eyePt = [];
234 var vec = viewUtils.parentToChildVec(parentPt, stage, eyePt);
233 if (vec) 235 if (vec)
234 { 236 {
235 // activate the drag working plane 237 // activate the drag working plane
@@ -241,7 +243,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
241 var wp = currentWorkingPlane.slice(0); 243 var wp = currentWorkingPlane.slice(0);
242 var mat = viewUtils.getMatrixFromElement(stage); 244 var mat = viewUtils.getMatrixFromElement(stage);
243 wp = MathUtils.transformPlane(wp, mat); 245 wp = MathUtils.transformPlane(wp, mat);
244 var eyePt = viewUtils.getEyePoint();
245 var projPt = MathUtils.vecIntersectPlane(eyePt, vec, wp); 246 var projPt = MathUtils.vecIntersectPlane(eyePt, vec, wp);
246 if (projPt) 247 if (projPt)
247 { 248 {
@@ -709,8 +710,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
709 var wp = currentWorkingPlane.slice(0); 710 var wp = currentWorkingPlane.slice(0);
710 var mat = viewUtils.getMatrixFromElement(stage); 711 var mat = viewUtils.getMatrixFromElement(stage);
711 wp = MathUtils.transformPlane(wp, mat); 712 wp = MathUtils.transformPlane(wp, mat);
712 var eyePt = viewUtils.getEyePoint(); 713 var eyePt = [];
713 var vec = viewUtils.parentToChildVec(gPt, stage); 714 var vec = viewUtils.parentToChildVec(gPt, stage, eyePt);
714 var projPt = MathUtils.vecIntersectPlane(eyePt, vec, wp); 715 var projPt = MathUtils.vecIntersectPlane(eyePt, vec, wp);
715 var wpMat = drawUtils.getPlaneToWorldMatrix(currentWorkingPlane, MathUtils.getPointOnPlane(currentWorkingPlane)); 716 var wpMat = drawUtils.getPlaneToWorldMatrix(currentWorkingPlane, MathUtils.getPointOnPlane(currentWorkingPlane));
716 projPt[3] = 1.0; 717 projPt[3] = 1.0;
@@ -1067,8 +1068,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1067 // Snapping is done in screen space, so convert the bounds from 1068 // Snapping is done in screen space, so convert the bounds from
1068 // local element space to global screen space 1069 // local element space to global screen space
1069 var bounds3D = new Array(); 1070 var bounds3D = new Array();
1071 var eltMat = viewUtils.getLocalToGlobalMatrix( elt );
1070 for (var i=0; i<4; i++) 1072 for (var i=0; i<4; i++)
1071 bounds3D[i] = viewUtils.localToGlobal( bounds[i], elt ); 1073 bounds3D[i] = viewUtils.localToGlobal2(bounds[i], eltMat);
1072 1074
1073 var hitRec = this.snapToScreenBounds( elt, globalScrPt, bounds, bounds3D ); 1075 var hitRec = this.snapToScreenBounds( elt, globalScrPt, bounds, bounds3D );
1074 1076