Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(website): make the rail's scale a function of the stage, not a constant
Etienne Lescot84599e6a47da
diff --git a/website/src/components/Recreation/driver.ts b/website/src/components/Recreation/driver.tsindex 25a00e18f..0becc1321 100644--- a/website/src/components/Recreation/driver.ts+++ b/website/src/components/Recreation/driver.ts@@ -23,7 +23,7 @@*/import { CURSORS } from "./generated";-import { BEATS, CUT_INDEX, type Frame, frameAt, strikeOf, T_TOTAL } from "./scene";+import { BEATS, CUT_INDEX, type Frame, frameAt, railScale, strikeOf, T_TOTAL } from "./scene";export interface DriverRefs {band: HTMLElement;@@ -93,7 +93,7 @@ const WRITTEN = ["--palette","--wand","--comment",- "--flow-y",+ "--k","--trim-0","--trim-1","--trim-2",@@ -225,7 +225,17 @@ export function attachDriver(refs: DriverRefs, cls: DriverClasses): () => void {* share one flow container, so showing them together would measure each one* stacked below the others.*/+ /* The rail's scale, which is a function of the stage and not of the frame —+ so it is written here, where resizes land, rather than every rAF. The+ stylesheet's own `--k` is the resting value for a reader who never gets+ the driver; this overrides it as soon as there is a width to divide. */+ const sizeRail = () => {+ const w = root.getBoundingClientRect().width;+ if (w > 0) root.style.setProperty("--k", railScale(w).toFixed(2));+ };+const measure = () => {+ sizeRail();const had = root.dataset.beat;const claimed = new Set<string>();// Transitions off for the pass: see .stage[data-measuring].diff --git a/website/src/components/Recreation/index.tsx b/website/src/components/Recreation/index.tsxindex 4dab80218..d7ed4ca9c 100644--- a/website/src/components/Recreation/index.tsx+++ b/website/src/components/Recreation/index.tsx@@ -55,7 +55,6 @@ import {CLIPS,CUT_INDEX,FLOOR_H,- K,LANES,PLAYHEAD,SPEED,@@ -69,7 +68,11 @@ import styles from "./styles.module.css";/* ── geometry helpers ─────────────────────────────────────────────────────── *//** Rail positions are static; only the rail itself is translated. */-const x = (sec: number) => `${(sec * K).toFixed(1)}px`;+/* Seconds, resolved against the rail's scale at paint time rather than baked in+ here. --k moves with the stage's width, and the rail's own transform already+ reads it, so children placed this way stay nailed to the ruler at any width.+ Inline styles, so postcss never sees this calc. */+const x = (sec: number) => `calc(${sec.toFixed(3)} * var(--k) * 1px)`;/** The twelve wallpapers the picker shows, in the design's order. */const WALLPAPERS = [2, 5, 8, 11, 1, 4, 6, 7, 9, 10, 12, 13];diff --git a/website/src/components/Recreation/scene.ts b/website/src/components/Recreation/scene.tsindex 3afbdb395..3e882ba70 100644--- a/website/src/components/Recreation/scene.ts+++ b/website/src/components/Recreation/scene.ts@@ -213,6 +213,21 @@ export const strikeOf = (i: number) => {/** Pixels per second of footage. Every object on the rail is placed with it and* the rail is translated by it, so the whole timeline is one transform. */export const K = 90;+/**+ * How much of the take the rail shows, and why it is not a constant.+ *+ * K is pixels per second of footage. Held fixed, the window it opens is the+ * stage's width divided by it — sixteen seconds at 1440, and four at the width+ * of a phone. Four seconds is not a timeline; it is one pill at a time drifting+ * past, and it makes any portrait layout pointless before it is drawn.+ *+ * So the reference is the SPAN, not the scale: sixteen seconds, which is what+ * 1440px at K already gives, and the scale follows from the width. Capped at K+ * so nothing wider than the reference zooms in — a large display keeps showing+ * more of the take rather than the same amount, larger.+ */+export const RAIL_SECONDS = 1440 / K;+export const railScale = (stageWidth: number) => Math.min(K, stageWidth / RAIL_SECONDS);/** The playhead's x, as a fraction of the stage. */export const PLAYHEAD = 0.38;