5fb4b59b7c358560c21a4ac877cada918dcc959e tdreszer Fri Jul 30 15:14:48 2010 -0700 Hopefully smoothing the dragging of tall tracks diff --git src/hg/js/jquery.tablednd.js src/hg/js/jquery.tablednd.js index b243da4..92415c6 100644 --- src/hg/js/jquery.tablednd.js +++ src/hg/js/jquery.tablednd.js @@ -195,7 +195,8 @@ var docPos = this.getPosition(target); var mousePos = this.mouseCoords(ev); - return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y}; + ///////return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y}; + return {x:mousePos.x - docPos.x, y:docPos.height/2}; ///////// This is modified by tim because of tall tracks. }, /** Get the position of an element by going up the DOM tree and adding up all the offsets */ @@ -212,6 +213,7 @@ solution may need to take that into account, for now this seems to work in firefox, safari, ie */ e = e.firstChild; // a table cell } + var eHeight = e.height; //////////////// Height was added by tim because of tall tracks while (e.offsetParent){ left += e.offsetLeft; @@ -222,7 +224,8 @@ left += e.offsetLeft; top += e.offsetTop; - return {x:left, y:top}; + ///////return {x:left, y:top}; + return {x:left, y:top, height:eHeight}; ///////////// Height was added by tim because of tall tracks }, mousemove: function(ev) { @@ -299,7 +302,8 @@ rowHeight = parseInt(row.firstChild.offsetHeight)/2; } // Because we always have to insert before, we need to offset the height a bit - if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) { + //////////if ((y > rowY - rowHeight) && (y < (rowY + rowHeight))) { + if ((y > rowY) && (y < (rowY + rowHeight))) { ////////// This was modified by tim because of tall tracks // that's the row we're over // If it's the same as the current row, ignore it if (row == draggedRow) {return null;}