8e279300b1726f355767b467bc699685e90d487b max Tue Apr 21 06:27:16 2026 -0700 composite hgTrackUi: fix btn_minus_all to hide parent, remember last vis, refs #37182 Two fixes around composite visibility on hgTrackUi: 1) The global [-] button (btn_minus_all) unchecked all subtracks but left the composite visibility dropdown unchanged. The earlier fix in 814472876ea covered only the matrix-corner [-] (_matSetMatrixCheckBoxes); the global button goes through matSubCBsCheck, which is now updated to the same pattern. 2) [-] / [+] and individual subCB clicks now remember the prior visibility via a data-last-viz attribute on the dropdown. Hiding stashes the current value; re-showing restores it (falling back to pack/dense if nothing saved) instead of always jumping to pack. Factored into two helpers in hui.js: hideCompositeSaveVis() and an extended exposeAll(). subCfg.onUserCbChange (individual subCB/matCB path) delegates to the same helpers so behavior is uniform. Co-Authored-By: Claude Opus 4.7 (1M context) diff --git src/hg/js/subCfg.js src/hg/js/subCfg.js index 4a845136f5b..da12c712b3a 100644 --- src/hg/js/subCfg.js +++ src/hg/js/subCfg.js @@ -52,51 +52,42 @@ if (obj.type === "checkbox") { var boolshad = normed($("input.cbShadow#boolshad\\."+obj.id)); if (boolshad) { $(boolshad).addClass('changed'); } else { boolshad = normed($("input.cbShadow[name='boolshad\\." + obj.name+"']")); if (boolshad) { $(boolshad).addClass('changed'); } } } }, // Called only on real user clicks (bound via native addEventListener, not jQuery, // so jQuery .trigger('change') calls during init do not reach this). - // Handles both subCB and matCB clicks. + // Handles both subCB and matCB clicks. Delegates to hui.js helpers so the + // same data-last-viz save/restore behavior applies as for the [+]/[-] buttons. onUserCbChange: function () { var compEl = $("[name='"+subCfg.compositeName+"']"); if (compEl.length === 0) return; var anyChecked = $(".subCB:checked:visible").length > 0; - - // if any subtracks are now checked and the composite is on hide, set it to pack (or dense) - if (anyChecked && compEl.val() === "hide") { - if (compEl.children('option[value="pack"]').length) - compEl.val("pack").change(); - else if (compEl.children('option[value="dense"]').length) - compEl.val("dense").change(); - else - compEl.prop('selectedIndex', compEl.children('option').length - 1).change(); - } - - // if no subtracks are checked, set the composite to hide - if (!anyChecked) - compEl.val("hide"); + if (anyChecked && compEl.val() === "hide") + exposeAll(); + else if (!anyChecked) + hideCompositeSaveVis(); }, clearChange: function (obj) { // Mark as unchanged $(obj).removeClass('changed'); // checkboxes have hidden boolshads which should be cleared in tandem if (obj.type === "checkbox") { var boolshad = normed($("input.cbShadow#boolshad\\."+obj.id)); if (boolshad) { $(boolshad).removeClass('changed'); } else { boolshad = normed($("input.cbShadow[name='boolshad\\." + obj.name+"']")); if (boolshad) { $(boolshad).removeClass('changed');