973799e0105452c5abc032e7b036a43c81259f00 max Fri Sep 4 03:23:15 2020 -0700 next step of fixing the highlight bug with the new format, refs #26166 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 33f1cbe..0635e06 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2496,31 +2496,31 @@ if (tdbIsSubtrack(rec)) { row = $( 'tr#tr_' + id ); rows = dragReorder.getCompositeSet(row); // from bottom up, just in case remove screws with us if (rows && rows.length > 0) { for (var rIx=rows.length - 1; rIx >= 0; rIx--) { $(rows[rIx]).remove(); } selectUpdated = vis.update(rec.parentTrack, 'hide'); cart.setVars( [rec.parentTrack], ['hide']); imageV2.afterImgChange(true); } } } else if (cmd === 'jumpToHighlight') { // If highlight exists for this assembly, jump to it if (hgTracks.highlight && rightClick.clickedHighlightIdx!==null) { - var newPos = parsePositionWithDb(hgTracks.highlight.split("|")[rightClick.clickedHighlightIdx]); + var newPos = getHighlight(hgTracks.highlight, rightClick.clickedHighlightIdx); if (newPos && newPos.db === getDb()) { if ( $('#highlightItem').length === 0) { // not visible? jump to it var curPos = parsePosition(genomePos.get()); var diff = ((curPos.end - curPos.start) - (newPos.end - newPos.start)); if (diff > 0) { // new position is smaller then current, then center it newPos.start = Math.max( Math.floor(newPos.start - (diff/2) ), 0 ); newPos.end = newPos.start + (curPos.end - curPos.start); } } if (imageV2.inPlaceUpdate) { var params = "position=" + newPos.chrom+':'+newPos.start+'-'+newPos.end; imageV2.navigateInPlace(params, null, true); } else { genomePos.setByCoordinates(newPos.chrom, newPos.start, newPos.end); jQuery('body').css('cursor', 'wait'); @@ -2921,49 +2921,46 @@ titleStr += "Show merged items"; } else { titleStr += "Merge items that span the current region"; } o[titleStr] = {onclick: function(menuItemClick, menuObject) { rightClick.hit(menuItemClick, menuObject, "toggleMerge", rec); return true; } }; } menu.push($.contextMenu.separator); menu.push(o); } menu.push($.contextMenu.separator); if (hgTracks.highlight && rightClick.clickedHighlightIdx!==null) { - - if (hgTracks.highlight.search(getDb() + '.') === 0) { var currentlySeen = ($('#highlightItem').length > 0); o = {}; // Jumps to highlight when not currently seen in image var text = (currentlySeen ? " Zoom" : " Jump") + " to highlight"; o[rightClick.makeImgTag("highlightZoom.png") + text] = { onclick: rightClick.makeHitCallback('jumpToHighlight') }; if ( currentlySeen ) { // Remove only when seen o[rightClick.makeImgTag("highlightRemove.png") + " Remove highlight"] = { onclick: rightClick.makeHitCallback('removeHighlight') }; } menu.push(o); } - } if (rec.isCustomComposite) { // add delete from composite } else if ((!rec.type.startsWith("wigMaf")) && (rec.type.startsWith("bigWig") || rec.type.startsWith("multiWig") || rec.type.startsWith("wig") || rec.type.startsWith("bedGraph"))) { o = {}; o[" Make a New Collection with \"" + rec.shortLabel + "\""] = { onclick: rightClick.makeHitCallback("newCollection") }; menu.push(o); if (hgTracks.collections) { var ii;