Storyboard: a refresh waits while a clip is playing or the author is typing

This commit is contained in:
gator 2026-09-22 23:08:43 +00:00
parent e359067b14
commit 7a0d3ab1b1

View file

@ -322,7 +322,18 @@
if (!busy && timer) { clearInterval(timer); timer = null; } if (!busy && timer) { clearInterval(timer); timer = null; }
} }
// A refresh redraws the whole storyboard. While the author is watching a
// clip, or typing a note, or has the background box open, that redraw
// would stop the player and throw the typing away - so it waits.
function authorBusy() {
var vids = document.querySelectorAll("#pane video");
for (var i = 0; i < vids.length; i++) if (!vids[i].paused && !vids[i].ended) return true;
var a = document.activeElement;
if (a && a.closest && a.closest("#pane") && /^(TEXTAREA|INPUT)$/.test(a.tagName)) return true;
return !!(BGEDIT || EDITING);
}
async function refresh() { async function refresh() {
if (authorBusy()) { tick(); return; }
var r = await api("run_status", { run_id: runId }); var r = await api("run_status", { run_id: runId });
if (!r.ok) return; if (!r.ok) return;
RUN = r.run; DRAFTS = r.drafts || []; RUN = r.run; DRAFTS = r.drafts || [];