dc88954b3214a3b414711c9e73dfa654bf0dffd9 hiram Tue Aug 6 12:58:18 2024 -0700 fixup mouseOver wiggle track when a track in wiggle mode switches to not wiggle mode, do not display the mouseOver. refs #34222 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 83a91f5..b2c400a 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4379,31 +4379,31 @@ // the ajax request may have generated an error or warning in the warnbox // so make sure those warnings still get to the user stripJsEmbedded(response, false, stripped); } if (valid) { if (imageV2.enabled && this.id && this.cmd && this.cmd !== 'wholeImage' && this.cmd !== 'selectWholeGene' && !newJson.virtChromChanged) { // Extract ... and update appropriate row in imgTbl; // this updates src in img_left_ID, img_center_ID and img_data_ID // and map in map_data_ID var id = this.id; - if (imageV2.updateImgForId(response, id, false)) { + if (imageV2.updateImgForId(response, id, false, newJson)) { imageV2.afterReload(id); imageV2.updateBackground(response); // Added by galt to update window separators } else { warn("Couldn't parse out new image for id: " + id); // Very helpful when debugging and alert doesn't render the html: //alert("Couldn't parse out new image for id: " + id+"BR"+response); } } else { if (imageV2.enabled) { // Implement in-place updating of hgTracks image // GALT delaying this until after newJson updated in hgTracks so disguising works //genomePos.setByCoordinates(newJson.chromName, newJson.winStart + 1, newJson.winEnd); $("input[name='c']").val(newJson.chromName); $("input[name='l']").val(newJson.winStart); $("input[name='r']").val(newJson.winEnd); @@ -4924,66 +4924,67 @@ // is visible or not, just ask it for status // tracks{} - tracks that were set up initially, key is track name // value is the number of items (for debugging) // maximumWidth{} - key is track name, value is length of longest // number string as measured when rendered // given hgt_....png file name, change to hgt_....json file name jsonFileName: function(imgDataId) { var jsonFile=imgDataId.src.replace(".png", ".json"); return jsonFile; }, // called from: updateImgForId when it has updated a track in place // need to refresh the event handlers and json data - updateMouseOver: function (trackName, trackDb) + updateMouseOver: function (trackName, newJson) { + if (! newJson ) { return; } + var trackDb = null; + for (id in newJson.trackDb) { + if (id === trackName) { + trackDb = newJson.trackDb[id]; + break; + } + } var trackType = null; var hasChildren = null; if (trackDb) { trackType = trackDb.type; hasChildren = trackDb.hasChildren; } else if (hgTracks.trackDb && hgTracks.trackDb[trackName]) { trackType = hgTracks.trackDb[trackName].type; } else if (mouseOver.trackType[trackName]) { trackType = mouseOver.trackType[trackName]; } + var validType = false; + if (trackType) { + if (trackType.indexOf("wig") === 0) { validType = true; } + if (trackType.indexOf("bigWig") === 0) { validType = true; } + if (trackType.indexOf("wigMaf") === 0) { validType = false; } + if (hasChildren) { validType = false; } + } + if (! validType ) { return; } var tdData = "td_data_" + trackName; var tdDataId = document.getElementById(tdData); var imgData = "img_data_" + trackName; var imgDataId = document.getElementById(imgData); if (imgDataId && tdDataId) { var url = mouseOver.jsonFileName(imgDataId); - if (mouseOver.tracks[trackName]) { // > 0 -> seen before in receiveData $( tdDataId ).mousemove(mouseOver.mouseMoveDelay); $( tdDataId ).mouseout(mouseOver.popUpDisappear); mouseOver.fetchJsonData(url); // may be a refresh, don't know - } else { - if (trackType) { - var validType = false; - if (trackType.indexOf("wig") === 0) { validType = true; } - if (trackType.indexOf("bigWig") === 0) { validType = true; } - if (trackType.indexOf("wigMaf") === 0) { validType = false; } - if (hasChildren) { validType = false; } - if (validType) { - $( tdDataId ).mousemove(mouseOver.mouseMoveDelay); - $( tdDataId ).mouseout(mouseOver.popUpDisappear); - mouseOver.fetchJsonData(url); - } - } - } } }, // given an X coordinate: x, find the index idx // in the rects[idx] array where rects[idx].x1 <= x < rects[idx].x2 // returning -1 when not found // if we knew the array was sorted on x1 we could get out early // when x < x1 // Note, different track types could have different intersection // procedures. For example, the HiC track will need to intersect // the mouse position within the diamond/square defined by the // items in the display. findRange: function (x, rects) { var answer = -1; // assmume not found