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);