diff options
author | Eric Guzman | 2012-04-11 11:03:09 -0700 |
---|---|---|
committer | Eric Guzman | 2012-04-11 11:03:09 -0700 |
commit | d203070579c8106b846657592a794ca8b4b1a9b6 (patch) | |
tree | a68566e581dbb96c5463031cb31131fbac8aa066 /js/helper-classes/3D/snap-manager.js | |
parent | 435dde54bf607620947007f7c66bd98bd03fe90b (diff) | |
parent | 9d1c919a4865ab1a2b0b0b9fc893a54b145c82c0 (diff) | |
download | ninja-d203070579c8106b846657592a794ca8b4b1a9b6.tar.gz |
Merge branch 'refs/heads/master' into CSSPanelUpdates
Diffstat (limited to 'js/helper-classes/3D/snap-manager.js')
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 12 |
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 | ||