Repository navigation
Commit eee0c51
authored
perf(studio): smooth timeline zoom on long projects (#5109)
* perf(studio): coalesce timeline zoom to one write per frame and zoom to a range
* perf(studio): coalesce timeline zoom to one write per frame and zoom to a range
Every zoom input goes through one owner that writes the store once per frame.
zoomTimelineToRange eases to a time range; the zoom buttons use it.
* feat(studio): zoom-to-range reports done or cancelled and is not a person zoom
* perf(studio): place clips in percent of a one-second layer so zoom restyles nothing
A zoom step rewrites one width per row; clip thumbnails start decoding at rest.
* perf(studio): a zoom step re-renders only clips whose drawing it changes
Clip handlers read the lane callbacks when pressed, so a skipped clip never acts on a stale zoom.
* refactor(studio): move at-rest waveform and thumbnail work to its own change
* perf(studio): draw waveforms and decode thumbnails when the timeline rests
Waveforms draw only the visible span of a clip.
A zoom or scroll step stretches what is drawn until the timeline rests.
* test(studio): fade handles measure the clip only while they show
* test(studio): waveforms draw their visible span and redraw at rest
* feat(studio): export currentTimelineRange, the inverse of zoomTimelineToRange
* perf(studio): zoom gestures scale the drawn timeline and lay it out once at rest
No layout or render per gesture frame; past 0.67x or 2x the preview is laid out and continues.
* perf(studio): rebase a zoom preview only past 0.5x or 4x
Clips stay mounted half a viewport each side, so a zoom-out preview to 0.5x shows no gaps.
* fix(studio): keep the zoom readout, edges and Fit right during a preview
The slider and its percent follow a zoom while it is previewed. A zoom in
from below Fit no longer jumps when it lands: the preview now uses the
width the timeline will really have. A zoom-out lays out as soon as it
would show time with no clips mounted, so edges never show empty strips.
Fit, a press or a scroll on the timeline end a pending zoom first. An
older abort no longer cancels a newer zoom-to-range, and an instant one
lands on the next frame instead of inside its caller. Range selection and
gap tints scale with the preview.
* fix(studio): keep a pending zoom when the timeline re-registers its view
The timeline registers its scroll view again whenever clips are added or
removed, which used to drop a zoom still waiting to be laid out. Now only
a real unmount drops it, and unmounting one timeline leaves a newer
timeline's registration alone.
* refactor(studio): share the zoom geometry helpers the timeline already has
Zoom scales come from getTimelinePixelsPerSecond, the range margins from one
helper, and a zoom step starts from the same playhead anchor every zoom uses.
The clip minimum width is named and shared with the drag ghost.
* fix(studio): keep a zoom preview through scrolls and past the content end
A scroll during a zoom preview, including the one a laid-out zoom makes
itself, used to lay the next preview out at once, so a pinch or eased zoom
fell back to a full layout every frame. A scroll now only rescales what it
mounted. Zooming out also lays out before the preview shows past where the
ruler and beat lines are drawn, not only past the mounted clips.
* fix(studio): keep a moved audio clip's waveform drawn where it shows
A waveform now draws the stretch of its clip that the shared strip tracker
reports near the screen, the tracker the filmstrip already uses. It follows
scrolls, resizes and moves (a drag or ripple that shifts the clip), so a
moved clip no longer shows a blank stretch, and a zoom redraws it once.
* perf(studio): lay a zoom-out step out once, at its start
An eased zoom-out (a Zoom out click, or zooming out to a range) used to
lay out partway, once the shrinking preview reached time with nothing
mounted, and again at the end. It now lays the target out first and eases
by scaling that layout down from the old view, so each click lays out
once. Each eased frame also draws its preview in that frame.
* fix(studio): keep previewing a zoom at the content's end and over new rows
The preview now lays out only once it would show past the window the
timeline draws clips, ruler ticks and beat lines in, with two pixels of
slack, so rounding at the content's end no longer lays out every frame.
Rows mounted into the timeline during a preview are scaled before they
paint.
* fix(studio): redraw a waveform when its clip's width changes or it moves
A waveform drawn whole kept its old bars, stretched, after a zoom changed
its clip's width; it now redraws on any resize. A long clip also marks
its undrawn ends for the strip tracker, so a move without a scroll (a
ripple, a drop, an undo) re-measures it instead of leaving a blank
stretch.
* perf(studio): skip the layout when a zoom preview ends on its own scale
An eased zoom-out lays its target out first, so its preview ends on the
scale already laid out. Landing it now only sets the scroll, instead of
writing the same zoom again and counting the person's zoom twice.
* fix(studio): measure filmstrips and waveforms after a zoom preview ends
The strip tracker measured clip boxes while a zoom preview scaled them,
so after a Zoom out click a long clip's filmstrip or waveform could stay
blank across part of the screen. Reads during a preview now wait, and the
tracker re-measures every strip once the preview ends. A zoom-out lays its
target out in its first frame rather than inside the caller, and only when
the new view holds the old one.
* perf(studio): watch a waveform's undrawn ends only when it has some
A clip drawn whole has no undrawn ends, so it no longer mounts the two
empty markers the strip tracker watches; with hundreds of short audio
clips that saved an observer entry each.
* fix(studio): measure strips each time a zoom preview is laid out
A zoom-out lays its target out partway into the ease, after which the
strip tracker kept the stretch it measured before the zoom, so a long
filmstrip or waveform went partly blank near the end of the ease. Every
layout of a preview now re-measures the strips.
* docs(studio): keep the zoom-to-range doc comment within four lines
* docs(studio): keep the zoom files' comment share at or under main's
The comment ratchet failed on ten files this branch touches. Comments are
cut or folded into one line; no code changes.1 parent 1825c37 commit eee0c51
34 files changed
Lines changed: 2009 additions & 437 deletions
File tree
- packages/studio/src
- components
- hooks
- player
- components
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
242 | 318 | | |
243 | 319 | | |
244 | 320 | | |
| |||
251 | 327 | | |
252 | 328 | | |
253 | 329 | | |
| 330 | + | |
254 | 331 | | |
255 | 332 | | |
256 | 333 | | |
| |||
263 | 340 | | |
264 | 341 | | |
265 | 342 | | |
| 343 | + | |
266 | 344 | | |
267 | 345 | | |
268 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| |||
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
173 | | - | |
174 | | - | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
| |||
215 | 213 | | |
216 | 214 | | |
217 | 215 | | |
218 | | - | |
219 | | - | |
220 | 216 | | |
221 | 217 | | |
222 | 218 | | |
| |||
510 | 506 | | |
511 | 507 | | |
512 | 508 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
| 509 | + | |
519 | 510 | | |
520 | 511 | | |
521 | 512 | | |
| |||
528 | 519 | | |
529 | 520 | | |
530 | 521 | | |
531 | | - | |
532 | | - | |
| 522 | + | |
533 | 523 | | |
534 | 524 | | |
535 | | - | |
536 | | - | |
| 525 | + | |
| 526 | + | |
537 | 527 | | |
538 | 528 | | |
539 | 529 | | |
| |||
542 | 532 | | |
543 | 533 | | |
544 | 534 | | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 535 | + | |
551 | 536 | | |
552 | 537 | | |
553 | 538 | | |
| |||
558 | 543 | | |
559 | 544 | | |
560 | 545 | | |
561 | | - | |
| 546 | + | |
562 | 547 | | |
563 | 548 | | |
564 | 549 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
10 | 19 | | |
11 | 20 | | |
12 | 21 | | |
| |||
48 | 57 | | |
49 | 58 | | |
50 | 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 | + | |
51 | 116 | | |
52 | 117 | | |
53 | 118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
28 | 31 | | |
29 | 32 | | |
30 | 33 | | |
| |||
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
97 | 101 | | |
98 | 102 | | |
99 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
100 | 118 | | |
101 | 119 | | |
| 120 | + | |
102 | 121 | | |
103 | 122 | | |
104 | 123 | | |
| |||
122 | 141 | | |
123 | 142 | | |
124 | 143 | | |
| 144 | + | |
125 | 145 | | |
126 | 146 | | |
127 | 147 | | |
| |||
153 | 173 | | |
154 | 174 | | |
155 | 175 | | |
| 176 | + | |
156 | 177 | | |
157 | 178 | | |
158 | 179 | | |
| |||
164 | 185 | | |
165 | 186 | | |
166 | 187 | | |
| 188 | + | |
167 | 189 | | |
168 | 190 | | |
169 | 191 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
0 commit comments