From 8cb0cbc033905a8be5be8d0cd88861ef71faa049 Mon Sep 17 00:00:00 2001 From: skaphan Date: Tue, 7 Apr 2026 19:59:26 -0700 Subject: [PATCH 1/2] Fix pie chart auto-play stopping on no-transfer rounds Add resumeFrom() to round player so the pie chart can advance the dropdown during auto-play without stopping playback. When the pie chart skips a round with no transfers, updateRound() now calls resumeFrom() instead of setStep() to keep the animation going. Co-Authored-By: Claude Opus 4.6 --- static/visualizer/round-player.js | 12 +++++++++++- templates/pie/pie-nonblocking.html | 10 +++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/static/visualizer/round-player.js b/static/visualizer/round-player.js index 14914706..c10eb070 100644 --- a/static/visualizer/round-player.js +++ b/static/visualizer/round-player.js @@ -158,6 +158,16 @@ function RoundPlayer({ "Play Animation"; } + // Resume playback from a specific step without resetting to round 0. + // Used when the pie chart skips a no-transfer round during auto-play + // and needs the round player to catch up without interrupting playback. + function resumeFrom(step) { + changeStep(step); + if (!isPlaying) return; + window.clearTimeout(timer); + nextStep(stepTimeMs); + } + function playing() { return isPlaying; } @@ -168,5 +178,5 @@ function RoundPlayer({ init(); - return { play, stop, setStep, setTimeBetweenStepsMs, playing }; + return { play, stop, setStep, resumeFrom, setTimeBetweenStepsMs, playing }; } diff --git a/templates/pie/pie-nonblocking.html b/templates/pie/pie-nonblocking.html index e18da237..2b0f54e2 100644 --- a/templates/pie/pie-nonblocking.html +++ b/templates/pie/pie-nonblocking.html @@ -50,9 +50,17 @@ // When the pie chart is animating it knows it is advancing rounds, but to avoid reactive // loops it requests to be told the new currentRound rather than using 2-way binding. // And we also update the slider state while we're at it. + // + // During auto-play, use resumeFrom() to update the dropdown and reset + // the timer without stopping playback. This matters when the pie chart + // skips a no-transfer round and needs to advance immediately. function updateRound(roundNum) { pieChart.currentRound = roundNum; - pieRoundPlayer.setStep(roundNum - 1); + if (pieRoundPlayer.playing()) { + pieRoundPlayer.resumeFrom(roundNum - 1); + } else { + pieRoundPlayer.setStep(roundNum - 1); + } } From 5cfd2235e1e5e34ce0950d3d146db17ea617f62a Mon Sep 17 00:00:00 2001 From: skaphan Date: Tue, 7 Apr 2026 21:21:48 -0700 Subject: [PATCH 2/2] Simplify auto-play fix: just skip setStep during playback Revert round-player.js changes. The simpler approach is to skip the setStep() call entirely during auto-play so it does not stop playback. The round player timer catches up on its next tick. Co-Authored-By: Claude Opus 4.6 --- static/visualizer/round-player.js | 12 +----------- templates/pie/pie-nonblocking.html | 9 +++------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/static/visualizer/round-player.js b/static/visualizer/round-player.js index c10eb070..14914706 100644 --- a/static/visualizer/round-player.js +++ b/static/visualizer/round-player.js @@ -158,16 +158,6 @@ function RoundPlayer({ "Play Animation"; } - // Resume playback from a specific step without resetting to round 0. - // Used when the pie chart skips a no-transfer round during auto-play - // and needs the round player to catch up without interrupting playback. - function resumeFrom(step) { - changeStep(step); - if (!isPlaying) return; - window.clearTimeout(timer); - nextStep(stepTimeMs); - } - function playing() { return isPlaying; } @@ -178,5 +168,5 @@ function RoundPlayer({ init(); - return { play, stop, setStep, resumeFrom, setTimeBetweenStepsMs, playing }; + return { play, stop, setStep, setTimeBetweenStepsMs, playing }; } diff --git a/templates/pie/pie-nonblocking.html b/templates/pie/pie-nonblocking.html index 2b0f54e2..3f7c7385 100644 --- a/templates/pie/pie-nonblocking.html +++ b/templates/pie/pie-nonblocking.html @@ -51,14 +51,11 @@ // loops it requests to be told the new currentRound rather than using 2-way binding. // And we also update the slider state while we're at it. // - // During auto-play, use resumeFrom() to update the dropdown and reset - // the timer without stopping playback. This matters when the pie chart - // skips a no-transfer round and needs to advance immediately. + // During auto-play, skip the setStep() call — it stops playback. + // The round player's timer will catch up on its next tick. function updateRound(roundNum) { pieChart.currentRound = roundNum; - if (pieRoundPlayer.playing()) { - pieRoundPlayer.resumeFrom(roundNum - 1); - } else { + if (!pieRoundPlayer.playing()) { pieRoundPlayer.setStep(roundNum - 1); } }