Size parameter-plot window for vertical panels without scrolling

This commit is contained in:
salman committed 2026-11-05 17:50:08 +01:00
1 parent 141baeb779
commit c2fe503777
2 files changed
+47 -2

No files matched your search

+3 -2
View File
@@ -1656,8 +1656,9 @@ button:not(.tablinks):not(.action-btn):not(.editor-source-tab):not(.status-state
/* Parameter plots reuse the same floating shell as JSROOT, but keep their own
controls compact so most of the window remains available to Plotly. */
.parameter-plot-window {
height: min(560px, calc(100vh - var(--mu-status-height) - 36px));
max-height: calc(100vh - var(--mu-status-height) - 36px);
height: auto;
min-height: min(320px, calc(100vh - var(--mu-status-height) - 36px));
max-height: calc(100vh - var(--mu-status-height) - 24px);
width: min(720px, calc(100vw - 24px));
}
+44
View File
@@ -2624,6 +2624,45 @@ function showMusrfitParameterPlotWindow(parameterPath, jobName = "", preferredPa
return source ? [source] : [];
}
function updateParameterPlotWindowSize(rows, columns) {
try {
var win = shell.root || plotWindow;
if (!win || !win.style) return;
var vw = (typeof window !== "undefined" && window.innerWidth) ? window.innerWidth : 1200;
var vh = (typeof window !== "undefined" && window.innerHeight) ? window.innerHeight : 800;
var statusH = 38;
if (typeof getComputedStyle === "function") {
var cs = getComputedStyle(document.documentElement);
var sv = cs && cs.getPropertyValue ? cs.getPropertyValue("--mu-status-height") : "";
if (sv) statusH = parseFloat(sv) || statusH;
}
var maxWinH = Math.max(320, vh - statusH - 24);
var maxWinW = Math.max(360, vw - 24);
var chromeH = 0;
if (content && content.getBoundingClientRect) {
var cb = content.getBoundingClientRect();
var wb = win.getBoundingClientRect();
if (wb && cb) chromeH = Math.max(0, wb.height - cb.height);
}
if (!chromeH || chromeH < 60) chromeH = 110;
var contentW = Math.max(280, maxWinW - 24);
var panelW = (contentW - (Math.max(0, columns - 1) * 7)) / Math.max(1, columns);
var targetPanelH = panelW * 0.75;
var minPanelH = 160;
if (rows <= 1) {
win.style.height = "";
win.style.maxHeight = maxWinH + "px";
return;
}
var gaps = Math.max(0, rows - 1) * 7;
var idealH = chromeH + (rows * Math.max(minPanelH, Math.min(targetPanelH, 420))) + gaps + 12;
var winH = Math.min(maxWinH, Math.max(320, idealH));
// If constrained by viewport, 4:3 is not forced; grid uses 1fr rows.
win.style.height = Math.round(winH) + "px";
win.style.maxHeight = maxWinH + "px";
} catch (e) {}
}
function applyLayout(layoutValue) {
let match = /^(\d+)x(\d+)$/.exec(layoutValue);
let rows = match ? Number(match[1]) : 1;
@@ -2631,6 +2670,7 @@ function showMusrfitParameterPlotWindow(parameterPath, jobName = "", preferredPa
visiblePanelCount = rows * columns;
panelGrid.style.gridTemplateColumns = "repeat(" + columns + ", minmax(0, 1fr))";
panelGrid.style.gridTemplateRows = "repeat(" + rows + ", minmax(0, 1fr))";
updateParameterPlotWindowSize(rows, columns);
// The fixed options list may not cover the resolved auto grid, so make the
// active layout selectable and visible in the Plot options panel.
@@ -2882,6 +2922,10 @@ function showMusrfitParameterPlotWindow(parameterPath, jobName = "", preferredPa
if (typeof ResizeObserver !== "undefined") {
resizeObserver = new ResizeObserver(function() {
try {
var match = /^(\d+)x(\d+)$/.exec(layoutSelect.value || "1x1");
updateParameterPlotWindowSize(match ? Number(match[1]) : 1, match ? Number(match[2]) : 1);
} catch (e) {}
if (!plotly || !plotly.Plots) return;
for (let i = 0; i < visiblePanelCount; i++) {
let panel = panelStates[i];