Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit c2f455b7c7ce218906c3b04ba7125d666e7f79fa
parent 9afec77e76e0aea638dca560cd3100ffd0a39c0e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 29 Oct 2026 00:52:03 -0400

umtool: the module preview loads its pages once and seeks them by message

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/components/projects/ModulesPanel.tsx | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/umtool/components/projects/ModulesPanel.tsx b/umtool/components/projects/ModulesPanel.tsx @@ -206,8 +206,14 @@ function LayerPreview({ layers, frame, total }: { layers: Layer[]; frame: { W: n }, [frame.W]); const first = layers.flatMap((l) => l.windows ?? []).find((w) => w.src); useEffect(() => { - if (first) setT(first.from + 0.8); + if (first) { + setT(first.from + 0.8); + for (const f of boxRef.current?.querySelectorAll("iframe") ?? []) f.contentWindow?.postMessage({ type: "deck:seek", t: first.from + 0.8 }, "*"); + } }, [first?.src]); // eslint-disable-line react-hooks/exhaustive-deps + // The pages are loaded once; a scrub seeks them by message (never a new src). + const tRef = useRef(t); + tRef.current = t; const seek = useCallback((v: number) => { setT(v); for (const f of boxRef.current?.querySelectorAll("iframe") ?? []) f.contentWindow?.postMessage({ type: "deck:seek", t: v }, "*"); @@ -224,8 +230,8 @@ function LayerPreview({ layers, frame, total }: { layers: Layer[]; frame: { W: n <div ref={boxRef} className="relative w-full overflow-hidden rounded bg-[#222]" style={{ aspectRatio: `${frame.W} / ${frame.H}` }} data-testid="module-preview-frame"> <div style={{ position: "absolute", left: 0, top: 0, width: frame.W, height: frame.H, transform: `scale(${scale})`, transformOrigin: "0 0" }}> {frames.map((f) => ( - <iframe key={f.key} title={f.key} src={`${f.src}${f.src.includes("?") ? "&" : "?"}preview=1&still=${t}`} data-testid="module-preview-iframe" - onLoad={(e) => e.currentTarget.contentWindow?.postMessage({ type: "deck:seek", t }, "*")} + <iframe key={f.key} title={f.key} src={`${f.src}${f.src.includes("?") ? "&" : "?"}preview=1`} data-testid="module-preview-iframe" + onLoad={(e) => e.currentTarget.contentWindow?.postMessage({ type: "deck:seek", t: tRef.current }, "*")} style={{ position: "absolute", left: f.g.x, top: f.g.y, width: f.g.width, height: f.g.height, border: 0, background: "transparent", visibility: f.show ? "visible" : "hidden" }} /> ))} </div>