8e165b8a4b9f8da973d7c34b42be008fd90323d9 hiram Thu Aug 22 15:14:12 2024 -0700 another attempt fix for mouseOver wiggle changing when track type changes refs #34222 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 5ce6eb9..6c42e1f 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4927,37 +4927,44 @@ // 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, newJson) { if (! newJson ) { return; } + // this newJson object appears to be a single trackDb, not + // an array of them var trackDb = null; + // so, if the type attribute exists, then it is the trackDb + if (newJson.type) { + trackDb = newJson; + } else { // otherwise, search through the array for ( var 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; }