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(timeline): create pills wide enough to read, not just to see
Etienne Lescot0dcc8325be01
diff --git a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsxindex fa07316d2..490f4e0f4 100644--- a/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx+++ b/src/components/ai-edition/v4/V4Timeline.geometry.test.tsx@@ -196,14 +196,14 @@ describe("V4Timeline create-from-toolbar", () => {it("scales the new region's duration with the zoom", () => {const { tl } = renderTimeline();fireEvent.click(screen.getByTitle("buttons.addZoom"));- // 900px viewport / 1800 s = 0.5 px per second, so 40px of pill is 80 s.- expect(durationOf(tl)).toBeCloseTo(80, 3);+ // 900px viewport / 1800 s = 0.5 px per second, so a 96px pill is 192 s.+ expect(durationOf(tl)).toBeCloseTo(192, 3);- // Zoomed to the 50x ceiling the same 40px is worth 1.6 s: same pill on+ // Zoomed to the 50x ceiling the same 96px is worth 3.84 s: same pill on// screen, a region 50x shorter.zoomIn(40);fireEvent.click(screen.getByTitle("buttons.addZoom"));- expect(durationOf(tl)).toBeCloseTo(1.6, 3);+ expect(durationOf(tl)).toBeCloseTo(3.84, 3);});it("never asks for a slice too short to be worth creating", () => {diff --git a/src/lib/ai-edition/timeline/newRegionDuration.test.ts b/src/lib/ai-edition/timeline/newRegionDuration.test.tsindex bf76bb115..ed68dbc1b 100644--- a/src/lib/ai-edition/timeline/newRegionDuration.test.ts+++ b/src/lib/ai-edition/timeline/newRegionDuration.test.ts@@ -12,14 +12,14 @@ describe("newRegionDurationSec", () => {it("trades duration for a constant width", () => {// The reported case: 30 minutes across a ~760px panel is 0.42 px/s, where a// flat 2 s region is under a pixel — invisible behind the playhead it was- // created at. At that scale 40px is worth a minute and a half.+ // created at. At that scale a readable pill is worth nearly four minutes.setTimelineScale(760 / 1800);- expect(newRegionDurationSec()).toBeCloseTo(94.7, 1);+ expect(newRegionDurationSec()).toBeCloseTo(227.4, 1);// Zoom in 50x and the same gesture creates a region 50x shorter — the pill// on screen is the same size either way, which is the whole point.setTimelineScale((760 / 1800) * 50);- expect(newRegionDurationSec()).toBeCloseTo(1.89, 2);+ expect(newRegionDurationSec()).toBeCloseTo(4.55, 2);});it("stays at the floor when the pixels are worth almost nothing", () => {diff --git a/src/lib/ai-edition/timeline/newRegionDuration.ts b/src/lib/ai-edition/timeline/newRegionDuration.tsindex d73077ac7..e45f77a20 100644--- a/src/lib/ai-edition/timeline/newRegionDuration.ts+++ b/src/lib/ai-edition/timeline/newRegionDuration.ts@@ -20,9 +20,20 @@* agent, auto-zooms) don't call this and keep useTimeline's flat default.*/-/** On-screen width a freshly created pill aims for. Clears PILL_CONTENT_MIN_PX,- * so it shows its icon and label at once with room to grab either handle. */-export const PILL_CREATE_PX = 40;+/**+ * On-screen width a freshly created pill aims for: wide enough to READ, not just+ * to see. Measured in a browser, the width each label needs before the ellipsis+ * bites — icon + gap + text + padding — is "Full Camera" 93px, "Annotation"+ * 90px, "1.80×" 61px, "1.5×" 55px. 96 covers the longest with a couple of px to+ * spare; longer translations of those two still ellipsize, which is what the+ * ellipsis is for.+ *+ * The cost of a wide default is a long region: at full zoom-out on a 30-minute+ * recording (~0.42 px/s) one click creates about 3 min 45 s. That is the trade+ * the constant width implies — the duration is the variable, and the pill is+ * immediately draggable by either edge.+ */+export const PILL_CREATE_PX = 96;/** Floor on the duration. Only bites past ~30x zoom, where 40px is worth a few* hundredths of a second and the region would be born unusable. */export const PILL_CREATE_MIN_SEC = 0.25;