Scenes: clear stale text/image when a track (re)starts

On restart, lastScene was reset to null and a channel with nothing active at
t=0 also evaluated to null, so the diff saw 'no change' and never sent the hide
command — leftover scene text stayed on screen. Use an undefined sentinel so
advanceCues applies (and thus clears) every channel once at scene start.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
lucianoandClaude Opus 4.8 committed 2026-06-22 14:56:40 +02:00
1 parent 56230cb3b0
commit 57a6bea3b4
1 file changed
+5 -2
+5 -2
View File
@@ -277,7 +277,10 @@ let lastScene = { effect: null, text: null, image: null };
function startCues(tr) { function startCues(tr) {
tr.cues = migrateCues(tr.cues || []); tr.cues = migrateCues(tr.cues || []);
activeCues = tr.cues.slice().sort((a, b) => a.time - b.time); activeCues = tr.cues.slice().sort((a, b) => a.time - b.time);
lastScene = { effect: null, text: null, image: null }; // `undefined` (not null) forces advanceCues to APPLY every channel once, so a
// stale text/image from the previous track is cleared even when the new scene
// has nothing active at t=0.
lastScene = { effect: undefined, text: undefined, image: undefined };
advanceCues(0); advanceCues(0);
} }
function sceneActive(type, t) { function sceneActive(type, t) {
@@ -327,7 +330,7 @@ function applyImageEl(el) {
function refreshScenePreview(i) { function refreshScenePreview(i) {
if (i !== currentIndex) return; if (i !== currentIndex) return;
activeCues = (playlist[i].cues || []).slice().sort((a, b) => a.time - b.time); activeCues = (playlist[i].cues || []).slice().sort((a, b) => a.time - b.time);
lastScene = { effect: null, text: null, image: null }; lastScene = { effect: undefined, text: undefined, image: undefined };
advanceCues(playCur || 0); advanceCues(playCur || 0);
} }