src/hg/js/hgTracks.js 1.44
1.44 2009/10/17 22:36:03 larrym
ignore drag activity in gray tab and track title column; fixes "jumping coordinates" bug found by ann
Index: src/hg/js/hgTracks.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hgTracks.js,v
retrieving revision 1.43
retrieving revision 1.44
diff -b -B -U 4 -r1.43 -r1.44
--- src/hg/js/hgTracks.js 16 Sep 2009 19:52:52 -0000 1.43
+++ src/hg/js/hgTracks.js 17 Oct 2009 22:36:03 -0000 1.44
@@ -5,8 +5,10 @@
var originalPosition;
var originalSize;
var originalCursor;
var clickClipHeight;
+var revCmplDisp;
+var insideX;
var startDragZoom = null;
var newWinWidth;
var imageV2 = false;
var imgBoxPortal = false;
@@ -99,17 +101,21 @@
var imgWidth = jQuery(img).width();
var imgHeight = jQuery(img).height();
var imgOfs = jQuery(img).offset();
var slop = 10;
- return (selection.event.pageX >= (imgOfs.left - slop)) && (selection.event.pageX < (imgOfs.left + imgWidth + slop))
+
+ // We ignore clicks in the gray tab and track title column (we really should suppress all drag activity there,
+ // but I don't know how to do that with imgAreaSelect).
+ var leftX = revCmplDisp ? imgOfs.left - slop : imgOfs.left + insideX - slop;
+ var rightX = revCmplDisp ? imgOfs.left + imgWidth - insideX + slop : imgOfs.left + imgWidth + slop;
+
+ return (selection.event.pageX >= leftX) && (selection.event.pageX < rightX)
&& (selection.event.pageY >= (imgOfs.top - slop)) && (selection.event.pageY < (imgOfs.top + imgHeight + slop));
}
function updatePosition(img, selection, singleClick)
{
// singleClick is true when the mouse hasn't moved (or has only moved a small amount).
- var insideX = parseInt(document.getElementById("hgt.insideX").value);
- var revCmplDisp = parseInt(document.getElementById("hgt.revCmplDisp").value) == 0 ? false : true;
var chromName = document.getElementById("hgt.chromName").value;
var winStart = parseInt(document.getElementById("hgt.winStart").value);
var winEnd = parseInt(document.getElementById("hgt.winEnd").value);
if(typeof imgBoxPortalStart != "undefined" && imgBoxPortalStart) {
@@ -167,10 +173,10 @@
function selectChange(img, selection)
{
initVars();
- updatePosition(img, selection, false);
if(checkPosition(img, selection)) {
+ updatePosition(img, selection, false);
jQuery('body').css('cursor', originalCursor);
} else {
jQuery('body').css('cursor', 'not-allowed');
}
@@ -270,8 +276,10 @@
}
clickClipHeight = parseInt(rulerEle.value);
newWinWidth = parseInt(document.getElementById("hgt.newWinWidth").value);
+ revCmplDisp = parseInt(document.getElementById("hgt.revCmplDisp").value) == 0 ? false : true;
+ insideX = parseInt(document.getElementById("hgt.insideX").value);
imgAreaSelect = jQuery((trackImgTbl || trackImg).imgAreaSelect({ selectionColor: 'blue', outerColor: '',
minHeight: imgHeight, maxHeight: imgHeight,
onSelectStart: selectStart, onSelectChange: selectChange, onSelectEnd: selectEnd,