From 802e92eb70b00849dadacf2c6590d27edbe65d99 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Wed, 8 Feb 2012 15:39:47 -0800 Subject: bug fixes for better anchor point rotation and removing snapping on hover and mouse down --- js/helper-classes/RDGE/GLAnchorPoint.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js/helper-classes/RDGE/GLAnchorPoint.js') diff --git a/js/helper-classes/RDGE/GLAnchorPoint.js b/js/helper-classes/RDGE/GLAnchorPoint.js index 6b4af072..716f59d4 100644 --- a/js/helper-classes/RDGE/GLAnchorPoint.js +++ b/js/helper-classes/RDGE/GLAnchorPoint.js @@ -55,6 +55,11 @@ GLAnchorPoint.prototype.setNextFromPrev = function () { //translate the next point from the translation that was applied to the prev. point GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) { + //do nothing if the total translation is zero + var totalTransSq = (tx*tx) + (ty*ty) + (tz*tz); + if (totalTransSq < 0.0000001) + return; + // *** compute the rotation of the prev vector *** var oldP = Vector.create([this._prevX + tx - this._x, this._prevY + ty - this._y, this._prevZ + tz - this._z]); var newP = Vector.create([this._prevX - this._x, this._prevY - this._y, this._prevZ - this._z]); @@ -71,6 +76,7 @@ GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) { //TEMP for some situations the axis angle computation returns NaNs if (isNaN(newN[0]) || isNaN(newN[1]) || isNaN(newN[2])) { + console.log("NaN in translateNextFromPrev"); return; } //end TEMP @@ -80,6 +86,11 @@ GLAnchorPoint.prototype.translateNextFromPrev = function (tx, ty, tz) { } //translate the next point from the translation that was applied to the prev. point GLAnchorPoint.prototype.translatePrevFromNext = function (tx, ty, tz) { + //do nothing if the total translation is zero + var totalTransSq = (tx*tx) + (ty*ty) + (tz*tz); + if (totalTransSq < 0.0000001) + return; + // *** compute the rotation of the next vector *** var oldN = Vector.create([this._nextX + tx - this._x, this._nextY + ty - this._y, this._nextZ + tz - this._z]); var newN = Vector.create([this._nextX - this._x, this._nextY - this._y, this._nextZ - this._z]); -- cgit v1.2.3