Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(website): stop the measuring pass flashing a caption on resize

Etienne Lescot0be44a2d26a3
diff --git a/website/src/components/Recreation/driver.ts b/website/src/components/Recreation/driver.ts
index a345ba228..28f56efbb 100644
--- a/website/src/components/Recreation/driver.ts
+++ b/website/src/components/Recreation/driver.ts
@@ -265,6 +265,18 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {
if (was) root.style.setProperty(css, was);
else root.style.removeProperty(css);
}
+ /* Flush the restored state while transitions are still suppressed.
+
+ Without this the browser's last computed style is the one from the end
+ of the loop — the transcript beat, because it is measured last — and
+ re-enabling transitions animates FROM there back to the real beat. On a
+ resize, which is when this runs, "Edit video like text" appeared at
+ full opacity and faded out over 0.4s. Suppressing the transitions made
+ that worse rather than better: it took the caption to 1 instantly
+ instead of starting a fade that would be interrupted. Reading a layout
+ property here makes the restored state the one transitions start from,
+ so there is nothing to animate. */
+ void root.offsetHeight;
delete root.dataset.measuring;
};
diff --git a/website/src/components/Recreation/styles.module.css b/website/src/components/Recreation/styles.module.css
index b75af1957..e9b356cc7 100644
--- a/website/src/components/Recreation/styles.module.css
+++ b/website/src/components/Recreation/styles.module.css
@@ -76,7 +76,12 @@
actually measure — 95px at every one of the five beats — plus air; it used
to reserve 116 and waste 21. */
--nav: var(--ifm-navbar-height, 60px);
- --pnl-w: 336px;
+ /* The inspector's width, and it gives before the picture does. Fixed at 336
+ it took a third of a 1011px window, which starved the picture of width —
+ and a 16:9 picture starved of width leaves height unused, which is the
+ void that opens under it on a narrow, tall screen. It stops at 280, which
+ is what the sliders and the four-column swatch grid need. */
+ --pnl-w: clamp(280px, 30vw, 336px);
--cap-h: 104px;
--tl-h: 210px;
/* One gutter for both layouts, and a formula rather than a breakpoint: it