9605057f1ed02af69d1509ba6a6ad9ac6955d2fc tdreszer Wed Sep 28 15:28:00 2011 -0700 UCSC specific mods to table DnD broke subtrack DnD. Now fixed. Redmine 5494 diff --git src/hg/js/jquery.tablednd.js src/hg/js/jquery.tablednd.js index d52a476..2b007d9 100644 --- src/hg/js/jquery.tablednd.js +++ src/hg/js/jquery.tablednd.js @@ -135,54 +135,54 @@ var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table); cells.each(function() { // The cell is bound to "this" jQuery(this).mousedown(function(ev) { if(ev.button > 1) return true; if(jQuery.tableDnD == undefined) return false; jQuery.tableDnD.dragObject = this.parentNode; jQuery.tableDnD.currentTable = table; jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev); config.dragStartIndex = $(jQuery.tableDnD.dragObject).attr('rowIndex'); if (config.onDragStart) { // Call the onDrop method if there is one config.onDragStart(ev, table, this.parentNode); + } /////// UCSC // Initialize oldY to avoid movingDown as first action jQuery.tableDnD.oldY = jQuery.tableDnD.mouseCoords(ev).y - jQuery.tableDnD.mouseOffset.y; // Capture the mouse move events only if dragStart jQuery(document) .bind('mousemove', jQuery.tableDnD.mousemove) .bind('mouseup', jQuery.tableDnD.mouseup); config.downOffset = 0; config.upOffset = 0; if (config.dragObjects.length > 1) { for(var ix = 0; ix < config.dragObjects.length; ix++) { var row = config.dragObjects[ix]; var rowIx = $(row).attr('rowIndex'); if (rowIx < config.dragStartIndex) config.upOffset -= $(row).height(); else if (rowIx > config.dragStartIndex) config.downOffset += $(row).height(); } } /////// UCSC - } return false; }); }) } else { // For backwards compatibility, we add the event to the whole row var rows = jQuery("tr", table); // get all the rows as a wrapped set rows.each(function() { // Iterate through each row, the row is bound to "this" var row = jQuery(this); if (! row.hasClass("nodrag")) { row.mousedown(function(ev) { if (ev.target.tagName == "TD") { jQuery.tableDnD.dragObject = this; jQuery.tableDnD.currentTable = table; jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);