cf8d4ff57d9b734f42d0afd66df6b8e6fb64a50a max Fri Jan 10 02:21:52 2025 -0800 just comments diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index f07702b..f2da447 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2142,31 +2142,39 @@ dragReorder.sort($("#imgTbl")); dragReorder.setOrder($("#imgTbl")); }, hideLegends : function() { /* if no pliBy track is shown, hide the pli legend */ hasPliTracks = false; for (var trDomEl of $(".imgOrd")){ var trackName = trDomEl.id.split("_")[1]; if (trackName.startsWith("pliBy")) hasPliTracks = true; } if (!hasPliTracks) $("#gnomadColorKeyLegend").hide(); }, hideTracks: function (ids) - /* hide specified list of tracks, take care to hide parents rather than children, whenever possible */ + /* hide specified list of tracks, take care to hide parents rather than children, whenever possible. This is + * addressing a basic problem of how we handle container tracks: if you right-click hide the last child, the container is still + * in the track list on the screen as not-hidden, but there are no + * tracks shown of this container. This is confusing for the user. The + * code below analyzes the track hierarchy and finds out if hiding a + * track would lead to a container becoming empty and instead of hiding + * just this track, will hide the container. It does this does both on + * screen and in the cart. This means that you cannot end up with a container that is + * not hidden but no tracks shown of this container, at least not with right-click. */ { var cartVars = []; var cartVals = []; // find parent tracks that are losing all their children (lone parents) var familyAnalysis = tdbFindChildless(hgTracks.trackDb, ids); // lone parents get special treatment for (var delFam of familyAnalysis.loneParents) { var loneParent = delFam[0]; var loneParentChildren = delFam[1]; // remove all the lone parent children now from the track image // and also unselect them, if they are children of a composite for (var childName of loneParentChildren) {