814472876eac4d004d61f0ed89bd2aaa07459d33
max
Thu Apr 9 06:42:24 2026 -0700
Fix composite vis: prefer pack over full, fix [-] button hide, refs #37182
Two issues from QA (note-17):
1) exposeAll() and onUserCbChange() always set composite to "full" when
re-enabling subtracks on tracks without a "pack" option. Now tries
pack first, then dense, then full as last resort.
2) The matrix [-] button (btn_minus_all_left_top) did not hide the
composite. _matSetMatrixCheckBoxes() called hideAll() which triggered
propagateVis, and propagateVis re-checked all subCBs when
checkedCount===0, undoing the hide. Fix: set composite to hide
directly via prop('selectedIndex', 0) without triggering propagateVis.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
diff --git src/hg/js/hui.js src/hg/js/hui.js
index 6e72f50a4d1..f129c051434 100644
--- src/hg/js/hui.js
+++ src/hg/js/hui.js
@@ -77,44 +77,61 @@
} else {
$( matCBs ).each( function (i) { matChkBoxNormalize( this, classesHidden ); });
}
}
matSubCBsSelected();
obj.lastIndex = obj.selectedIndex;
}
function matSelectViewForSubTracks(obj,view)
{
waitOnFunction( _matSelectViewForSubTracks, obj,view);
}
function exposeAll()
{
- // Make main display dropdown show full if currently hide
- var visDD = normed($("select.visDD")); // limit to hidden
+ // Make main display dropdown show pack if currently hide
+ var visDD = normed($("select.visDD"));
if (visDD) {
if ($(visDD).prop('selectedIndex') === 0) {
+ if ($(visDD).children('option[value="pack"]').length)
+ $(visDD).val("pack");
+ else if ($(visDD).children('option[value="dense"]').length)
+ $(visDD).val("dense");
+ else
$(visDD).prop('selectedIndex',$(visDD).children('option').length - 1);
$(visDD).trigger("change");// trigger on change code, which may trigger supertrack reshaping
} // and effecting inherited subtrack vis
// If superChild and hidden by supertrack, wierd things go on unless we trigger reshape
if ($(visDD).hasClass('superChild'))
visTriggersHiddenSelect(visDD);
}
}
+function hideAll()
+{
+ // Set main display dropdown to hide if no subtracks are checked
+ var visDD = normed($("select.visDD"));
+ if (visDD) {
+ if ($(visDD).prop('selectedIndex') !== 0) {
+ $(visDD).prop('selectedIndex', 0);
+ $(visDD).trigger("change");
+ }
+ }
+}
+
function matSubCbClick(subCB)
{
// subCB:onclick When a subtrack checkbox is clicked, it may result in
// Clicking/unclicking the corresponding matrix CB. Also the
// subtrack may be hidden as a result.
// NOTE: if "subCfg" then 'change' event will update it
if (isFauxDisabled(subCB,false)) { // disabled subCB is still clickable when "subCfg"
subCB.checked = true;
fauxDisable(subCB,false,""); // enable and get rid of message
}
matSubCBsetShadow(subCB,false);
hideOrShowSubtrack(subCB);
// When subCBs are clicked, 3-state matCBs may need to be set
var classes = matViewClasses('hidden');
@@ -189,30 +206,39 @@
subCbs = $( subCbs ).filter("."+arguments[sIx]); // Successively limit list
}
if (state) { // If clicking [+], further limit to only checked ABCs
var classes = matAbcCBclasses(false);
subCbs = objsFilterByClasses(subCbs,"not",classes); // remove unchecked abcCB classes
}
$( subCbs ).each( function (i) {
if (this.checked !== state) {
this.checked = state;
matSubCBsetShadow(this,false);
$(this).trigger("change"); // NOTE: if "subCfg" then 'change' event will update it
}
});
if (state)
exposeAll(); // Unhide composite vis?
+ else if ($("input.subCB:checked:visible").length === 0) {
+ // Set composite to hide directly, without triggering propagateVis
+ // (which would re-check all subCBs when checkedCount===0).
+ var visDD = normed($("select.visDD"));
+ if (visDD && $(visDD).prop('selectedIndex') !== 0) {
+ $(visDD).prop('selectedIndex', 0);
+ $(visDD).addClass('changed');
+ }
+ }
showOrHideSelectedSubtracks();
matSubCBsSelected();
var tbody = normed($('tbody.sortable'));
if (tbody)
$(tbody).removeClass('sorting');
return true;
}
function matSetMatrixCheckBoxes(state)
{ // Called exclusively by matrix [+][-] buttons on click
var tbody = normed($('tbody.sortable'));
if (tbody)
$(tbody).addClass('sorting');