Skip to content

Commit 7cf2a7c

Browse files
authored
Merge pull request #475 from Kaggle/add-hide-controls-support
Make sure the static visualizer respects the hide-controls option
2 parents cd57708 + 64885d3 commit 7cf2a7c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

web/core/src/player.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class Player {
1919
private playing = false;
2020
private speed = 500; // ms per step
2121
private mounted = false;
22+
private showControls = true;
2223

2324
// --- Element references ---
2425
private viewer: HTMLElement;
@@ -110,6 +111,11 @@ export class Player {
110111
const handleMessage = (event: MessageEvent) => {
111112
if (!event.data) return;
112113

114+
if (typeof event.data.controls === 'boolean') {
115+
this.showControls = event.data.controls;
116+
this.renderControls();
117+
}
118+
113119
let needsRender = false;
114120

115121
// Update agents if provided
@@ -224,7 +230,7 @@ export class Player {
224230
};
225231

226232
private renderControls() {
227-
if (!this.replay) {
233+
if (!this.replay || !this.showControls) {
228234
this.controls.style.display = 'none';
229235
return;
230236
}
@@ -245,4 +251,4 @@ export class Player {
245251
this.stepSlider.value = this.step.toString();
246252
this.stepCounter.textContent = `${this.step + 1} / ${maxSteps + 1}`;
247253
}
248-
}
254+
}

0 commit comments

Comments
 (0)