Fix parameter plot resize and toolbar visibility

This commit is contained in:
salman committed 2026-11-20 08:57:17 +01:00
1 parent edcf0c9025
commit 73214345f6
4 files changed
+43 -21

No files matched your search

+13 -19
View File
@@ -1684,44 +1684,38 @@ button:not(.tablinks):not(.action-btn):not(.editor-source-tab):not(.status-state
}
/* Plot tools are hidden until a deliberate tap/click inside this panel. */
.parameter-plot-window .js-plotly-plot .modebar {
.parameter-plot-window .js-plotly-plot .modebar,
.electron-parameter-plot-page .js-plotly-plot .modebar {
opacity: 0 !important;
pointer-events: none !important;
transition: opacity 120ms ease;
}
.parameter-plot-window .js-plotly-plot.modebar-open .modebar {
.parameter-plot-window .js-plotly-plot.modebar-open .modebar,
.electron-parameter-plot-page .js-plotly-plot.modebar-open .modebar {
opacity: 1 !important;
pointer-events: auto !important;
}
.parameter-plot-window .js-plotly-plot .modebar-container,
.parameter-plot-window .js-plotly-plot .modebar {
.parameter-plot-window .js-plotly-plot .modebar,
.electron-parameter-plot-page .js-plotly-plot .modebar-container,
.electron-parameter-plot-page .js-plotly-plot .modebar {
top: 2px !important;
right: 2px !important;
}
@media (max-width: 700px) {
.parameter-plot-window .js-plotly-plot .modebar-group {
.parameter-plot-window .js-plotly-plot .modebar-group,
.electron-parameter-plot-page .js-plotly-plot .modebar-group {
padding: 0 !important;
}
.parameter-plot-window .js-plotly-plot .modebar-btn {
.parameter-plot-window .js-plotly-plot .modebar-btn,
.electron-parameter-plot-page .js-plotly-plot .modebar-btn {
height: 28px !important;
width: 28px !important;
padding: 2px !important;
}
.parameter-plot-window .js-plotly-plot .modebar-btn svg {
height: 18px !important;
width: 18px !important;
}
}
.parameter-plot-window .js-plotly-plot .modebar-group {
padding: 0 !important;
}
.parameter-plot-window .js-plotly-plot .modebar-btn {
height: 28px !important;
width: 28px !important;
padding: 2px !important;
}
.parameter-plot-window .js-plotly-plot .modebar-btn svg {
.parameter-plot-window .js-plotly-plot .modebar-btn svg,
.electron-parameter-plot-page .js-plotly-plot .modebar-btn svg {
height: 18px !important;
width: 18px !important;
}
+5
View File
@@ -2628,6 +2628,11 @@ function showMusrfitParameterPlotWindow(parameterPath, jobName = "", preferredPa
try {
var win = shell.root || plotWindow;
if (!win || !win.style) return;
if (shell && shell.ownsWindow) {
win.style.height = "";
win.style.maxHeight = "";
return;
}
var vw = (typeof window !== "undefined" && window.innerWidth) ? window.innerWidth : 1200;
var vh = (typeof window !== "undefined" && window.innerHeight) ? window.innerHeight : 800;
var statusH = 38;
+1
View File
@@ -28,6 +28,7 @@ window.MusrfitParameterPlotPlatform.createPlotWindow = function() {
return {
root: document.body,
content: content,
ownsWindow: true,
keyTarget: document,
close: function() { window.close(); },
onClose: function(handler) {
+24 -2
View File
@@ -1146,9 +1146,26 @@ function testAxisScaleSurvivesRefresh() {
}
function testNativeParameterPlotResize() {
const plot = fs.readFileSync(path.join(repoRoot, "muSRFitParameterPlot.js"), "utf8");
const windowScript = fs.readFileSync(path.join(repoRoot, "parameter-plot-window.js"), "utf8");
const css = fs.readFileSync(path.join(repoRoot, "ZGUI.css"), "utf8");
const start = plot.indexOf("function updateParameterPlotWindowSize");
const end = plot.indexOf("function applyLayout", start);
assert.ok(start >= 0 && end > start);
const sizing = plot.slice(start, end);
assert.match(sizing, /if \(shell && shell\.ownsWindow\)/);
assert.match(sizing, /win\.style\.height = ""/);
assert.match(sizing, /win\.style\.maxHeight = ""/);
assert.match(windowScript, /ownsWindow: true/);
assert.match(css, /\.electron-parameter-plot-page-root,\s*body\.electron-parameter-plot-page\s*\{\s*height:\s*100%;/s);
assert.match(css, /\.electron-parameter-plot-page \.parameter-plot-content\s*\{\s*height:\s*100%;/s);
}
function testParameterToolbarVisibility() {
const plot = fs.readFileSync(path.join(repoRoot, "muSRFitParameterPlot.js"), "utf8");
const css = fs.readFileSync(path.join(repoRoot, "ZGUI.css"), "utf8");
const html = fs.readFileSync(path.join(repoRoot, "parameter-plot.html"), "utf8");
assert.match(plot, /displayModeBar: true/);
assert.match(plot, /addEventListener\("pointerdown"/);
assert.match(plot, /addEventListener\("pointerup"/);
@@ -1156,8 +1173,12 @@ function testParameterToolbarVisibility() {
assert.match(plot, /classList\.add\("modebar-open"\)/);
assert.match(plot, /document\.addEventListener\("pointerdown", dismissParameterModeBar, true\)/);
assert.match(plot, /document\.removeEventListener\("pointerdown", dismissParameterModeBar, true\)/);
assert.match(css, /\.js-plotly-plot \.modebar\s*\{[^}]*opacity: 0 !important;[^}]*pointer-events: none !important;/s);
assert.match(css, /\.js-plotly-plot\.modebar-open \.modebar\s*\{[^}]*opacity: 1 !important;[^}]*pointer-events: auto !important;/s);
const hiddenModebar = /\.parameter-plot-window \.js-plotly-plot \.modebar,\s*\.electron-parameter-plot-page \.js-plotly-plot \.modebar\s*\{[^}]*opacity: 0 !important;[^}]*pointer-events: none !important;/s;
const openModebar = /\.parameter-plot-window \.js-plotly-plot\.modebar-open \.modebar,\s*\.electron-parameter-plot-page \.js-plotly-plot\.modebar-open \.modebar\s*\{[^}]*opacity: 1 !important;[^}]*pointer-events: auto !important;/s;
assert.match(css, hiddenModebar);
assert.match(css, openModebar);
assert.match(html, /<body class="electron-parameter-plot-page">/);
assert.strictEqual((css.match(/{/g) || []).length, (css.match(/}/g) || []).length);
// Marker styling must remain available after removing the generic click handlers.
assert.match(plot, /panel\.chart\.on\("plotly_click"/);
}
@@ -1174,6 +1195,7 @@ testInlineParameterSource();
testParameterPlotLayoutModes();
testParameterPlotLayoutPersistence();
testDialogAndWindowLayoutPlumbing();
testNativeParameterPlotResize();
testTraceStyleAndOverlayFoundation();
testParameterStyleEditingFoundation();
testDataSetRegistryFoundation();