* fix(video): align scene narration and fit diagrams
- Refine bilingual prompts for scene-by-scene narration and visuals
- Fit and center SVG diagrams with their labels and strokes
- Improve geometry coordinate guidance and preserve layout retries
* fix(video): do not report a fitted scene graphic as overflow
The kit scales a graphic with a transform on its full-size frame, so the
scaled frame box and the SVG canvas can exceed the region while the drawing
fits. Measure HTML overflow without that transform and canvas.
---------
Co-authored-by: zzzworm <15828873+zzzworm86@user.noreply.gitee.com>
Co-authored-by: zszz3 <91608029+zszz3@users.noreply.github.com>
check_layout ran headless Chrome with text=True and no encoding, so the
server decoded --dump-dom with its ANSI code page. The report quotes the
lesson's own text; on a cp936/cp932 server running outside UTF-8 mode
(as under `deeptutor start`) a lesson with non-ASCII text came back as
mojibake, the JSON no longer parsed, and the check returned None, which
callers treat as "no browser available". The layout QA silently never
ran for those lessons.
Decode the browser's output as UTF-8.
The build check proves a lesson compiles and plays; it cannot see a drawing
crossing a title or a card covering a label. After a lesson builds, open
the bundle in headless Chrome at a frame every 4 s, measure every visible
text box and sample points along every visible SVG stroke, and send
collisions back to the writer in 1920x1080 coordinates:
- text overlapping text
- strokes passing through text (dash-aware)
- opaque boxes covering text outside them
- anything drawn in the caption band (y > 880)
Up to 2 layout rounds (MAX_ATTEMPTS 3 -> 4). The last bundle that built is
kept, so a layout fix that then fails to compile still returns the lesson
that played. The check is advisory: no Chrome, a probe error or a timeout
skips it. The English writer prompt gains a layout contract (safe area,
planned boxes, label spacing) and layout-aware retry guidance.