Commit a1d2ac0
committed
feat(desktop): add timeline slider to crop modal for frame-accurate cropping
Previously, the crop modal only showed the first frame of the video (a static
screenshot). I couldn't crop based on content that appeared later in the
recording, and I had to guess the crop and go back to the main timeline to check.
This change adds a timeline slider to the crop modal, allowing users to scrub
through the entire video and select any frame as their cropping reference.
## What's New
- **Timeline slider** below the crop preview with current time and total duration
- **Instant video scrubbing** using native <video> element with hardware-accelerated seeking
- **Preload strategy** where video metadata preloads on editor open, and full video preloads on Crop button hover/focus for instant display
- **Loading indicator** that shows a "Loading" pill while video buffers
- **Smooth crossfade** with a 150ms transition from screenshot to video
- **Screenshot fallback** that gracefully degrades if video fails to load
## Technical Notes
- Uses raw source video (display.mp4) for scrubbing, not the rendered output with effects. This is intentional as crop applies to the background layer, and effects render on top.
- Video is positioned absolute with object-contain to prevent layout shift while maintaining aspect ratio.
## Files Changed
- [apps/desktop/src/routes/editor/Editor.tsx](cci:7://file:///Users/MAC/Desktop/Desktop%20-%20Poe%27s%20MacBook%20Pro/Engineering/Open%20Source/Cap/apps/desktop/src/routes/editor/Editor.tsx:0:0-0:0) - crop dialogue with video, slider, loading indicator
- [apps/desktop/src/routes/editor/Player.tsx](cci:7://file:///Users/MAC/Desktop/Desktop%20-%20Poe%27s%20MacBook%20Pro/Engineering/Open%20Source/Cap/apps/desktop/src/routes/editor/Player.tsx:0:0-0:0) - preload on Crop button hover/focus
- [apps/desktop/src/routes/editor/context.ts](cci:7://file:///Users/MAC/Desktop/Desktop%20-%20Poe%27s%20MacBook%20Pro/Engineering/Open%20Source/Cap/apps/desktop/src/routes/editor/context.ts:0:0-0:0) - preload metadata on editor mount
- [apps/desktop/src/routes/editor/cropVideoPreloader.ts](cci:7://file:///Users/MAC/Desktop/Desktop%20-%20Poe%27s%20MacBook%20Pro/Engineering/Open%20Source/Cap/apps/desktop/src/routes/editor/cropVideoPreloader.ts:0:0-0:0) - new preload manager module
## How to Test
1. Open a recording in the editor
2. Hover over the "Crop" button (triggers video preload)
3. Click "Crop" to open the modal
4. Verify:
- Loading indicator appears briefly (if video not yet cached)
- Smooth crossfade from screenshot to video
- Slider shows current time (left) and total duration (right)
- Dragging slider updates video frame instantly
- Crop bounds can be adjusted at any frame
- Clicking "Save" persists the crop correctly1 parent fd35e3e commit a1d2ac0
File tree
8 files changed
+377
-48
lines changed- apps/desktop/src
- routes
- (window-chrome)
- editor
- packages/ui-solid/src
8 files changed
+377
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 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 | + | |
36 | 56 | | |
37 | 57 | | |
38 | 58 | | |
39 | 59 | | |
40 | 60 | | |
41 | 61 | | |
42 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
43 | 65 | | |
44 | 66 | | |
45 | 67 | | |
46 | 68 | | |
47 | | - | |
48 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
49 | 75 | | |
50 | 76 | | |
51 | 77 | | |
| |||
64 | 90 | | |
65 | 91 | | |
66 | 92 | | |
67 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
68 | 105 | | |
69 | 106 | | |
70 | 107 | | |
| |||
77 | 114 | | |
78 | 115 | | |
79 | 116 | | |
80 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
81 | 129 | | |
82 | 130 | | |
83 | 131 | | |
84 | 132 | | |
85 | 133 | | |
86 | 134 | | |
87 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
88 | 147 | | |
89 | 148 | | |
90 | 149 | | |
| |||
116 | 175 | | |
117 | 176 | | |
118 | 177 | | |
119 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
120 | 199 | | |
121 | 200 | | |
122 | 201 | | |
| |||
150 | 229 | | |
151 | 230 | | |
152 | 231 | | |
153 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
154 | 236 | | |
155 | | - | |
156 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
157 | 245 | | |
158 | 246 | | |
159 | 247 | | |
| |||
162 | 250 | | |
163 | 251 | | |
164 | 252 | | |
165 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
166 | 257 | | |
167 | 258 | | |
168 | 259 | | |
169 | 260 | | |
170 | | - | |
171 | | - | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
172 | 269 | | |
173 | 270 | | |
174 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
24 | 35 | | |
25 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
26 | 48 | | |
27 | 49 | | |
28 | 50 | | |
| |||
94 | 116 | | |
95 | 117 | | |
96 | 118 | | |
97 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
98 | 131 | | |
99 | 132 | | |
100 | 133 | | |
101 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
102 | 146 | | |
103 | 147 | | |
104 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
99 | 110 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 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 | + | |
110 | 152 | | |
111 | 153 | | |
112 | 154 | | |
| |||
0 commit comments