Hide inactive loss panel

This commit is contained in:
Meta Vens 2026-04-24 18:57:40 +01:00
commit 668a85ce99
3 changed files with 9 additions and 9 deletions

View file

@ -582,6 +582,10 @@ function renderLossPlaceholder(context: CanvasRenderingContext2D, width: number,
}
function renderLossChart(): void {
lossCanvas.hidden = state.stageKey !== "solver";
if (lossCanvas.hidden) {
return;
}
const context = lossCanvas.getContext("2d");
if (!context) {
return;
@ -600,10 +604,6 @@ function renderLossChart(): void {
context.lineTo(width, y);
context.stroke();
}
if (state.stageKey !== "solver") {
renderLossPlaceholder(context, width, state.stageLabel, state.statusText);
return;
}
const losses = state.frames
.filter((frame) => typeof frame.loss === "number")
.map((frame) => frame.loss as number);

View file

@ -456,6 +456,10 @@ function renderLossPlaceholder(context, width, heading, detail) {
drawWrappedCanvasText(context, detail, { x: 18, y: 38, maxWidth: width - 36, lineHeight: 20 });
}
function renderLossChart() {
lossCanvas.hidden = state.stageKey !== "solver";
if (lossCanvas.hidden) {
return;
}
const context = lossCanvas.getContext("2d");
if (!context) {
return;
@ -474,10 +478,6 @@ function renderLossChart() {
context.lineTo(width, y);
context.stroke();
}
if (state.stageKey !== "solver") {
renderLossPlaceholder(context, width, state.stageLabel, state.statusText);
return;
}
const losses = state.frames
.filter((frame) => typeof frame.loss === "number")
.map((frame) => frame.loss);

View file

@ -55,7 +55,7 @@
<span id="stepValue" class="step-value">No frames yet</span>
</div>
</div>
<canvas id="lossCanvas" class="loss-canvas" width="800" height="120"></canvas>
<canvas id="lossCanvas" class="loss-canvas" width="800" height="120" hidden></canvas>
<div class="viewer-grid viewer-grid-dual">
<figure class="viz-card">
<div class="viz-label" id="leftVizLabel">Input</div>