diff --git a/ZGUI.css b/ZGUI.css
index 8300bd3..88b637c 100644
--- a/ZGUI.css
+++ b/ZGUI.css
@@ -2094,36 +2094,27 @@ button:not(.tablinks):not(.action-btn):not(.editor-source-tab):not(.status-state
min-height: 0;
}
-/* A parameter plot in Electron lives in its own native BrowserWindow. Reuse
- the web plot renderer, but let the operating-system title bar provide the
- window controls and let the plot fill the entire native window. */
+/* A parameter plot in Electron lives in its own native BrowserWindow. The
+ shared renderer fills the page directly; the operating-system title bar is
+ the only window shell. */
+.electron-parameter-plot-page-root,
+body.electron-parameter-plot-page {
+ height: 100%;
+}
+
body.electron-parameter-plot-page {
background: var(--mu-panel);
- padding: 0;
-}
-
-.electron-parameter-plot-page .parameter-plot-window {
- border: 0;
- border-radius: 0;
- box-shadow: none;
- height: 100% !important;
- left: 0 !important;
+ display: flex;
margin: 0;
- max-height: none;
- max-width: none;
- position: static;
- resize: none;
- top: 0 !important;
- width: 100% !important;
-}
-
-.electron-parameter-plot-page .parameter-plot-header {
- display: none;
+ min-height: 0;
+ overflow: hidden;
+ padding: 0;
}
.electron-parameter-plot-page .parameter-plot-content {
height: 100%;
padding: 8px;
+ width: 100%;
}
/* Multi-panel parameter plots. The toolbar controls the currently selected
diff --git a/index.html b/index.html
index d87f7d0..58fff55 100644
--- a/index.html
+++ b/index.html
@@ -13,6 +13,7 @@
+
diff --git a/tests/parameter-plot.test.js b/tests/parameter-plot.test.js
index fa6f400..51a5c5f 100644
--- a/tests/parameter-plot.test.js
+++ b/tests/parameter-plot.test.js
@@ -86,11 +86,12 @@ function testIntegratedParameterTableHook() {
assert.match(lib, /selectParameterForPlot/);
assert.match(lib, /showMusrfitParameterAxisDialog\([\s\S]*selectedParameterPlotNames\.slice\(\)/);
assert.match(plot, /function showMusrfitParameterAxisDialog/);
- assert.match(plot, /showMusrfitParameterPlotWindow\(parameterPath, jobName, preferredParameters, xName\)/);
+ assert.match(plot, /platform\.openPlot\(\{/);
assert.match(plot, /preferredParameters = \[\]/);
assert.match(plot, /preferredXColumn = ""/);
assert.match(plot, /musrfitParameterColumnIndex\(dataset, name\)/);
- assert.match(plot, /openElectronAuxiliaryWindow\("parameterPlot"/);
+ assert.match(plot, /platform\.createPlotWindow/);
+ assert.doesNotMatch(plot, /openElectronAuxiliaryWindow|require\("electron"\)|amIWeb\(|fetch\(/);
assert.match(plot, /refreshButton\.textContent = "Refresh"/);
assert.match(plot, /readMusrfitParameterData\(parameterPath\)/);
assert.match(plot, /layoutSelect/);
@@ -100,7 +101,6 @@ function testIntegratedParameterTableHook() {
assert.doesNotMatch(plot, /parameter-plot-panel-caption/);
assert.match(plot, /parameter-plot-grid/);
assert.match(plot, /addButton\.addEventListener/);
- assert.match(plot, /selectParameterDataFile/);
assert.match(plot, /musrfitParameterErrorColumns/);
assert.match(plot, /mode: mode \|\| "markers"/);
assert.match(plot, /buildMusrfitParameterTrace\(panel\.dataset, xIndex, yIndex, panel\.mode\)/);
@@ -116,30 +116,36 @@ function testIntegratedParameterTableHook() {
}
-function testElectronUsesNativePlotWindow() {
- const code = fs.readFileSync(path.join(repoRoot, "muSRFitParameterPlot.js"), "utf8");
- const sent = [];
- const sandbox = {
- console: console,
- window: {
- openElectronAuxiliaryWindow: function(kind, options) {
- sent.push([kind, options]);
- return true;
- }
- },
- document: {},
- Promise: Promise,
- Set: Set
- };
- sandbox.global = sandbox;
- vm.runInNewContext(code, sandbox, { filename: "muSRFitParameterPlot.js" });
- sandbox.showMusrfitParameterPlotWindow("/tmp/514_asy_par.dat", "514_asy.msr", ["Asy", "Lam"], "dataT");
+function testPlatformSeparation() {
+ const plot = fs.readFileSync(path.join(repoRoot, "muSRFitParameterPlot.js"), "utf8");
+ const elec = fs.readFileSync(path.join(repoRoot, "muSRFitelec.js"), "utf8");
+ const elecAdapter = fs.readFileSync(path.join(repoRoot, "muSRFitParameterPlotElec.js"), "utf8");
+ const web = fs.readFileSync(path.join(repoRoot, "muSRFitweb.js"), "utf8");
+ const windowScript = fs.readFileSync(path.join(repoRoot, "parameter-plot-window.js"), "utf8");
+ const windowHtml = fs.readFileSync(path.join(repoRoot, "parameter-plot.html"), "utf8");
- assert.strictEqual(sent.length, 1);
- assert.strictEqual(sent[0][0], "parameterPlot");
- assert.strictEqual(sent[0][1].parameterPath, "/tmp/514_asy_par.dat");
- assert.deepStrictEqual(Array.from(sent[0][1].preferredParameters), ["Asy", "Lam"]);
- assert.strictEqual(sent[0][1].preferredXColumn, "dataT");
+ assert.doesNotMatch(plot, /require\(|openElectronAuxiliaryWindow|MusrfitStandaloneParameterPlot|amIWeb\(|fetch\(/);
+ assert.match(plot, /platform\.openPlot\(\{/);
+ assert.match(plot, /platform\.createPlotWindow/);
+ assert.match(plot, /platform\.readDataSource/);
+ assert.match(plot, /platform\.chooseDataSource/);
+ assert.match(plot, /platform\.loadPlotly/);
+
+ assert.match(elec, /MusrfitParameterPlotPlatform\.openPlot/);
+ assert.match(elec, /openElectronAuxiliaryWindow\("parameterPlot", options\)/);
+ assert.match(elecAdapter, /require\("plotly\.js-dist"\)/);
+ assert.match(elecAdapter, /readDataSource/);
+ assert.match(elecAdapter, /selectParameterDataFile/);
+
+ assert.match(web, /createWebMusrfitParameterPlotWindow/);
+ assert.match(web, /MusrfitParameterPlotPlatform\.createPlotWindow/);
+ assert.match(web, /MusrfitParameterPlotPlatform\.openPlot/);
+ assert.match(web, /MusrfitParameterPlotPlatform\.readDataSource/);
+
+ assert.match(windowScript, /MusrfitParameterPlotPlatform\.createPlotWindow/);
+ assert.match(windowScript, /showMusrfitParameterPlotWindow/);
+ assert.match(windowHtml, /muSRFitParameterPlotElec\.js/);
+ assert.doesNotMatch(windowHtml, /MusrfitStandaloneParameterPlot/);
}
function testElectronParameterExport() {
@@ -210,6 +216,6 @@ function testElectronParameterExport() {
testParserAndSmartDefaults();
testIntegratedParameterTableHook();
-testElectronUsesNativePlotWindow();
+testPlatformSeparation();
testElectronParameterExport();
console.log("Parameter plot tests passed");