51dcc54f59327aa1906d9ff48b785518b0014fa8 tdreszer Wed Aug 24 13:32:32 2011 -0700 Limiting panning by wingSize is not needed at this time. Correction made for portal coords being half open. diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 288b79e..e44c131 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -1067,48 +1067,48 @@ } function panner(e) { //if(!e) e = window.event; if ( mouseIsDown ) { var relativeX = (e.clientX - mouseDownX); if(relativeX != 0) { if (blockUseMap == false) { // need to throw up a z-index div. Wait mask? savedPosition = getPosition(); dragMaskShow(); blockUseMap = true; } var decelerator = 1; - var wingSize = 1000; // 0 stops the scroll at the edges. + //var wingSize = 1000; // 0 stops the scroll at the edges. // Remeber that offsetX (prevX) is negative newX = prevX + relativeX; if ( newX >= leftLimit ) { // scrolled all the way to the left if(atEdge) { // Do not drag straight off edge. Force second drag beyondImage = true; newX = leftLimit + (newX - leftLimit)/decelerator;// slower - if( newX >= leftLimit + wingSize) // Don't go too far over the edge! - newX = leftLimit + wingSize; + //if (newX >= leftLimit + wingSize) // Don't go too far over the edge! + // newX = leftLimit + wingSize; } else newX = leftLimit; } else if ( newX < rightLimit ) { // scrolled all the way to the right if(atEdge) { // Do not drag straight off edge. Force second drag beyondImage = true; newX = rightLimit - (rightLimit - newX)/decelerator;// slower - if( newX < rightLimit - wingSize) // Don't go too far over the edge! - newX = rightLimit - wingSize; + //if (newX < rightLimit - wingSize) // Don't go too far over the edge! + // newX = rightLimit - wingSize; } else newX = rightLimit; } else if(newX >= rightLimit && newX < leftLimit) beyondImage = false; // could have scrolled back without mouse up newX = panUpdatePosition(newX,true); var nowPos = newX.toString() + "px"; $(".panImg").css( {'left': nowPos }); $('.tdData').css( {'backgroundPosition': nowPos } ); if (!only1xScrolling) panAdjustHeight(newX); // NOTE: This will dynamically resize image while scrolling. Do we want to? } } } @@ -1154,31 +1154,31 @@ prevX = newX; if (!only1xScrolling) { //panAdjustHeight(newX); // NOTE: This will resize image after scrolling. Do we want to while scrolling? // This is important, since AJAX could lead to reinit after this within bounds scroll hgTracks.imgBoxPortalOffsetX = (prevX * -1) - hgTracks.imgBoxLeftLabel; hgTracks.imgBoxPortalLeft = newX.toString() + "px"; } } } } }); // end of this.each(function(){ function panUpdatePosition(newOffsetX,bounded) { // Updates the 'position/search" display with change due to panning - var portalWidthBases = hgTracks.imgBoxPortalEnd - hgTracks.imgBoxPortalStart; + var portalWidthBases = hgTracks.imgBoxPortalEnd - hgTracks.imgBoxPortalStart - 1; // Correction for half open portal coords var portalScrolledX = (hgTracks.imgBoxPortalOffsetX+hgTracks.imgBoxLeftLabel) + newOffsetX; var recalculate = false; var newPortalStart = hgTracks.imgBoxPortalStart - Math.round(portalScrolledX*hgTracks.imgBoxBasesPerPixel); // As offset goes down, bases seen goes up! if( newPortalStart < hgTracks.chromStart && bounded) { // Stay within bounds newPortalStart = hgTracks.chromStart; recalculate = true; } var newPortalEnd = newPortalStart + portalWidthBases; if( newPortalEnd > hgTracks.chromEnd && bounded) { newPortalEnd = hgTracks.chromEnd; newPortalStart = newPortalEnd - portalWidthBases; recalculate = true; } if(newPortalStart > 0) {