33992680e6261bbca8c30b1a94e93e5118e809e9 larrym Sat Jan 1 16:23:34 2011 -0800 fix problem caused when cytoband track is visible diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index b09df83..ffa68a4 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -549,30 +549,31 @@ offset = 1 - offset; return Math.round(offset * chr.size); } function convertFromBases(bases) { // Simple utility to convert bases to pix var offset = bases/chr.size; if(chr.reverse) offset = 1 - offset; return Math.round(offset * chr.width) + chr.left; } function findDimensions() { // Called at init: determine the dimensions of chrom from 'cytoband' map items var lastX = -1; $('.cytoBand').each(function(ix) { + if(this.coords) { var loc = this.coords.split(","); if(loc.length == 4) { var myLeft = parseInt(loc[0]); var myRight = parseInt(loc[2]); if( chr.top == -1) { chr.left = myLeft; chr.right = myRight; chr.top = parseInt(loc[1]); chr.bottom = parseInt(loc[3]); } else { if( chr.left > myLeft) chr.left = myLeft; if( chr.right < parseInt(loc[2])) chr.right = parseInt(loc[2]); } @@ -589,30 +590,31 @@ chr.beg = parseInt(pos[0]); } if( chr.end < parseInt(pos[1])) { chr.end = parseInt(pos[1]); if(lastX == -1) lastX = myRight; else if(lastX > myRight) chr.reverse = true; // end is advancing, but X is not, so reverse } else if(lastX != -1 && lastX < myRight) chr.reverse = true; // end is not advancing, but X is, so reverse } $(this).css( 'cursor', 'text'); $(this).attr("href",""); } + } }); chr.size = (chr.end - chr.beg ); chr.width = (chr.right - chr.left); } function findCytoBand(pxDown,pxUp) { // Called when mouseup and ctrl: Find the bounding cytoband dimensions, both in pix and bases var cyto = { left: -1, right: -1, beg: -1, end: -1 }; $('.cytoBand').each(function(ix) { var loc = this.coords.split(","); if(loc.length == 4) { var myLeft = parseInt(loc[0]); var myRight = parseInt(loc[2]); if(cyto.left == -1 || cyto.left > myLeft) { if( isWithin(myLeft,pxDown,myRight) || isWithin(myLeft,pxUp,myRight) ) {