Commit aa8d3bb
committed
fix(timeline): size pills and clips in px, not in fractions of the timeline
Reported on a 30-minute recording: agent-placed pills render far wider than the
effect they stand for, and the mismatch changes with the zoom.
Three screen-space rules were written as a fraction of `total`, which is a
DURATION in disguise — it scales with the recording, so what looked right on a
one-minute clip was nonsense on a podcast:
- `Math.max(1.5, pctOf(dur))` floored every pill at 1.5% of the timeline: 27 s
on a 30-minute project, 58 s on the 65-minute one this was measured against,
at every zoom level. Touching pills merged into one block and no pill could be
read as a duration.
- `total * 0.012` as the drag snap radius was a 21-second magnet, so an edge
jumped to a clip boundary it was nowhere near — the more so the longer the
recording, and the worse the further you zoomed in to place it precisely.
- `.tlClips`'s flex `gap: 6px` was a fixed pixel amount inserted into a
proportional layout: each junction pushed what followed 6px right while every
clip shrank to pay for it, so a clip's left edge missed its own start time
(+2px on clip 2, +6px on clip 3 of a three-clip timeline) while the pills and
ruler above it sat at the true position. Constant in px means it was worth 5 s
and 15 s of a 30-minute recording zoomed out, and a fraction of a second
zoomed in — that changing ratio is what reads as "the pills move when I zoom".
Everything on the canvas is now positioned by `pctOf` (clips included, now
absolutely positioned instead of flex), and everything that must be a fixed
SCREEN size goes through `pxPerSec`: `pillAffordance`, `PILL_SNAP_PX`,
`CLIP_GUTTER_PX`. The only floor left on a width is 1px, in CSS.
Handles follow from the width rather than fighting it. Above 18px (two 6px
handles + a grabbable body) they sit inside the pill as before; below it they
mount outside, with the gap on each side belonging to the pill's own hit strip
— so a 1px pill still offers ~9px to move and 6px per side to resize, at every
zoom. Nothing becomes unreachable at any size. The chrome re-flows mid-drag
without disturbing the gesture: deltas come from the pointer and the listeners
live on `window`. The flat 0.2 s minimum region is gone too (it refused the last
fifth of a second however far you zoomed in); the floor is now the storage grid,
1 ms, since how SHORT a region may be is a data question and how PRECISELY you
can aim at one is the zoom's business.
Measured in the app on the reported project (65 min, 15 agent-placed trims):
zoomed out each trim was drawn at 22.4px (58.5 s) and now sits at its true
0.45–6.94 s; zoomed 30x the old floor would have been 672px. Clip 2 now starts
at exactly 50% of the canvas instead of +3px. Every test in
V4Timeline.geometry.test.tsx was ablated — reverting each constant turns the
matching one red.1 parent ada1a0d commit aa8d3bb
4 files changed
Lines changed: 395 additions & 27 deletions
File tree
- src/components/ai-edition/v4
- technical-documentation/architecture
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1330 | 1330 | | |
1331 | 1331 | | |
1332 | 1332 | | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1333 | 1338 | | |
1334 | 1339 | | |
1335 | 1340 | | |
| |||
1352 | 1357 | | |
1353 | 1358 | | |
1354 | 1359 | | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
1355 | 1381 | | |
1356 | 1382 | | |
1357 | 1383 | | |
| |||
1378 | 1404 | | |
1379 | 1405 | | |
1380 | 1406 | | |
1381 | | - | |
1382 | | - | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
1383 | 1415 | | |
1384 | 1416 | | |
1385 | 1417 | | |
| |||
1398 | 1430 | | |
1399 | 1431 | | |
1400 | 1432 | | |
1401 | | - | |
1402 | | - | |
1403 | | - | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
1404 | 1446 | | |
1405 | 1447 | | |
1406 | 1448 | | |
| |||
Lines changed: 227 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
0 commit comments