🔀 merge(T17): timeline zoom
Browse files at this commit2 changed files +503 -50
- crates/app/src/keymap.rs +32 -6
- crates/app/src/main.rs +471 -44
crates/app/src/keymap.rsmodified+32 -6
| @@ -63,6 +63,9 @@ pub enum ActionId { | ||
| 63 | 63 | Color, |
| 64 | 64 | Fit, |
| 65 | 65 | Resolution, |
| 66 | + ZoomIn, | |
| 67 | + ZoomOut, | |
| 68 | + ZoomFit, | |
| 66 | 69 | Undo, |
| 67 | 70 | AddVideoLane, |
| 68 | 71 | AddAudioLane, |
| @@ -80,7 +83,7 @@ pub enum ActionId { | ||
| 80 | 83 | impl ActionId { |
| 81 | 84 | /// Display order everywhere -- the editor lists them in it and |
| 82 | 85 | /// [`Keymap::defaults`] binds them in it. |
| 83 | - pub const ALL: [ActionId; 35] = [ | |
| 86 | + pub const ALL: [ActionId; 38] = [ | |
| 84 | 87 | ActionId::Play, |
| 85 | 88 | ActionId::StepBack, |
| 86 | 89 | ActionId::StepForward, |
| @@ -104,6 +107,9 @@ impl ActionId { | ||
| 104 | 107 | ActionId::Color, |
| 105 | 108 | ActionId::Fit, |
| 106 | 109 | ActionId::Resolution, |
| 110 | + ActionId::ZoomIn, | |
| 111 | + ActionId::ZoomOut, | |
| 112 | + ActionId::ZoomFit, | |
| 107 | 113 | ActionId::Undo, |
| 108 | 114 | ActionId::AddVideoLane, |
| 109 | 115 | ActionId::AddAudioLane, |
| @@ -144,6 +150,9 @@ impl ActionId { | ||
| 144 | 150 | ActionId::Color => "Colour…", |
| 145 | 151 | ActionId::Fit => "Fit policy: fit → fill → stretch → centre", |
| 146 | 152 | ActionId::Resolution => "Project resolution: source → 2160p → 1080p → 720p → 480p", |
| 153 | + ActionId::ZoomIn => "Zoom in on the timeline (around the playhead)", | |
| 154 | + ActionId::ZoomOut => "Zoom out of the timeline", | |
| 155 | + ActionId::ZoomFit => "Fit the whole timeline on screen", | |
| 147 | 156 | ActionId::Undo => "Undo", |
| 148 | 157 | ActionId::AddVideoLane => "Add a video track", |
| 149 | 158 | ActionId::AddAudioLane => "Add an audio track", |
| @@ -186,6 +195,9 @@ impl ActionId { | ||
| 186 | 195 | ActionId::Color => "color", |
| 187 | 196 | ActionId::Fit => "fit", |
| 188 | 197 | ActionId::Resolution => "resolution", |
| 198 | + ActionId::ZoomIn => "zoom-in", | |
| 199 | + ActionId::ZoomOut => "zoom-out", | |
| 200 | + ActionId::ZoomFit => "zoom-fit", | |
| 189 | 201 | ActionId::Undo => "undo", |
| 190 | 202 | ActionId::AddVideoLane => "add-video-lane", |
| 191 | 203 | ActionId::AddAudioLane => "add-audio-lane", |
| @@ -236,7 +248,11 @@ impl ActionId { | ||
| 236 | 248 | | ActionId::Silence => Category::Clips, |
| 237 | 249 | // The project's own picture size is not a clip's business, and not |
| 238 | 250 | // a file operation either: it is what the viewer is looking at. |
| 239 | - ActionId::Resolution => Category::View, | |
| 251 | + // Neither is how much of the timeline the panel shows: a zoom edits | |
| 252 | + // nothing, it magnifies. | |
| 253 | + ActionId::Resolution | ActionId::ZoomIn | ActionId::ZoomOut | ActionId::ZoomFit => { | |
| 254 | + Category::View | |
| 255 | + } | |
| 240 | 256 | ActionId::Cut |
| 241 | 257 | | ActionId::Regroup |
| 242 | 258 | | ActionId::Detach |
| @@ -307,7 +323,7 @@ pub const FIXED: [Fixed; 16] = [ | ||
| 307 | 323 | // holding anything else still does what one press did. |
| 308 | 324 | Fixed { |
| 309 | 325 | chord: "hold ← → ↑ ↓", |
| 310 | - label: "Run a card's slider, or the volume keys, while held", | |
| 326 | + label: "Run a card's slider, or the volume and zoom keys, while held", | |
| 311 | 327 | category: Category::View, |
| 312 | 328 | }, |
| 313 | 329 | Fixed { |
| @@ -544,6 +560,14 @@ impl Keymap { | ||
| 544 | 560 | // it changes what every clip is composed onto. |
| 545 | 561 | b(ActionId::Fit, "p", false), |
| 546 | 562 | b(ActionId::Resolution, "r", true), |
| 563 | + // The zoom pair, on the chords every editor and every browser | |
| 564 | + // magnifies with. The bare "=" and "-" are the volume keys, so | |
| 565 | + // these take the ctrl versions of them -- and ctrl+0 is the | |
| 566 | + // "back to 100%" of the same family, which here is the whole | |
| 567 | + // timeline across the bed. | |
| 568 | + b(ActionId::ZoomIn, "=", true), | |
| 569 | + b(ActionId::ZoomOut, "-", true), | |
| 570 | + b(ActionId::ZoomFit, "0", true), | |
| 547 | 571 | b(ActionId::Undo, "z", false), |
| 548 | 572 | b(ActionId::Undo, "z", true), |
| 549 | 573 | // The unshifted initials of what they add. Both were free -- |
| @@ -839,7 +863,7 @@ mod tests { | ||
| 839 | 863 | #[test] |
| 840 | 864 | fn every_default_stroke_reaches_its_action() { |
| 841 | 865 | let k = Keymap::defaults(); |
| 842 | - assert_eq!(k.entries().len(), 37); | |
| 866 | + assert_eq!(k.entries().len(), 40); | |
| 843 | 867 | assert_eq!(k.lookup("space", false), Some(ActionId::Play)); |
| 844 | 868 | // The seek keys: bare arrows a frame, ctrl arrows a second, and the two |
| 845 | 869 | // ends of the timeline. |
| @@ -1015,7 +1039,8 @@ mod tests { | ||
| 1015 | 1039 | // A bindable chord is one `rebind_action` may keep: what it writes is |
| 1016 | 1040 | // what the next load reads, for every stroke that passes here. |
| 1017 | 1041 | let mut k = Keymap::defaults(); |
| 1018 | - k.rebind_action(ActionId::Play, chord("=", true)).unwrap(); | |
| 1042 | + // Any free chord will do here; ctrl+= is the zoom's. | |
| 1043 | + k.rebind_action(ActionId::Play, chord("w", true)).unwrap(); | |
| 1019 | 1044 | assert_eq!(whole(&emit(&k)), k); |
| 1020 | 1045 | } |
| 1021 | 1046 | |
| @@ -1072,7 +1097,8 @@ mod tests { | ||
| 1072 | 1097 | assert_eq!(whole("edith-keys 1\n").display(ActionId::Cut), "unbound"); |
| 1073 | 1098 | // The label is the editor's column, and never the file's word for it. |
| 1074 | 1099 | assert_eq!(ActionId::CancelExport.label(), "Cancel export"); |
| 1075 | - assert_eq!(ActionId::ALL.len(), 35); | |
| 1100 | + assert_eq!(ActionId::ALL.len(), 38); | |
| 1101 | + assert_eq!(k.display(ActionId::ZoomIn), "ctrl+="); | |
| 1076 | 1102 | } |
| 1077 | 1103 | |
| 1078 | 1104 | #[test] |
crates/app/src/main.rsmodified+471 -44
| @@ -19,9 +19,9 @@ use engine::{Clip, ExportHandle, Frame, PlaybackSession}; | ||
| 19 | 19 | use gpui::{ |
| 20 | 20 | AnyElement, App, Application, Bounds, ClickEvent, Context, CursorStyle, Div, FocusHandle, |
| 21 | 21 | KeyDownEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PathBuilder, Pixels, |
| 22 | - Point, RenderImage, SharedString, Size, Stateful, TextAlign, TitlebarOptions, Window, | |
| 23 | - WindowBounds, WindowOptions, canvas, div, img, point, prelude::*, px, relative, rgb, rgba, | |
| 24 | - size, | |
| 22 | + Point, RenderImage, ScrollDelta, ScrollWheelEvent, SharedString, Size, Stateful, TextAlign, | |
| 23 | + TitlebarOptions, Window, WindowBounds, WindowOptions, canvas, div, img, point, prelude::*, px, | |
| 24 | + relative, rgb, rgba, size, | |
| 25 | 25 | }; |
| 26 | 26 | |
| 27 | 27 | /// Editor chrome: three grays and one accent, all darker than the picture so the |
| @@ -74,6 +74,11 @@ const LABEL_MIN_W: f32 = 36.; | ||
| 74 | 74 | /// allocates one bucket per window, so a rate taken from anything the user can |
| 75 | 75 | /// influence is an allocation bomb -- and 40 is already finer than the pixels a |
| 76 | 76 | /// clip is ever given. |
| 77 | +/// | |
| 78 | +/// ponytail: "finer than the pixels" stops being true once the timeline is | |
| 79 | +/// zoomed -- past ~25 ms per bucket the envelope reads as steps rather than as | |
| 80 | +/// a shape. Ceiling: [`View::max_zoom`]'s 8 frames across the bed. The upgrade | |
| 81 | +/// is a second, finer pass over the visible span only, cached like `waves` is. | |
| 77 | 82 | const WAVE_BPS: u32 = 40; |
| 78 | 83 | /// Pixels per envelope column. Coarser than a pixel: the eye reads the shape, |
| 79 | 84 | /// and a path with a point per pixel is a path per repaint. |
| @@ -594,6 +599,10 @@ struct Player { | ||
| 594 | 599 | /// The ruler's own box, recorded at prepaint: a mouse listener is handed |
| 595 | 600 | /// the window position and nothing else. |
| 596 | 601 | ruler: Rc<Cell<Bounds<Pixels>>>, |
| 602 | + /// How much of the timeline the ruler and the lanes are showing. Held here | |
| 603 | + /// and nowhere else: every frame-to-pixel answer in the panel comes out of | |
| 604 | + /// it, so the boxes, the playhead and the pointer cannot disagree. | |
| 605 | + view: View, | |
| 597 | 606 | /// Which clip the edit keys act on: the lane it is in and its index there. |
| 598 | 607 | /// The *clicked* half, not the group -- a group is what gets marked on |
| 599 | 608 | /// screen, but Lift has to know which half it was aimed at. Indices move |
| @@ -916,6 +925,12 @@ impl Player { | ||
| 916 | 925 | ActionId::Color => self.open_color(cx), |
| 917 | 926 | ActionId::Fit => self.cycle_fit(cx), |
| 918 | 927 | ActionId::Resolution => self.cycle_resolution(cx), |
| 928 | + // The playhead is what a key zoom is aimed at: it is the one place | |
| 929 | + // on the timeline the user is certainly looking at, and keeping it | |
| 930 | + // still is what every editor does. | |
| 931 | + ActionId::ZoomIn => self.zoom(ZOOM_STEP, None, cx), | |
| 932 | + ActionId::ZoomOut => self.zoom(1. / ZOOM_STEP, None, cx), | |
| 933 | + ActionId::ZoomFit => self.zoom_fit(cx), | |
| 919 | 934 | ActionId::Undo => self.undo(cx), |
| 920 | 935 | ActionId::AddVideoLane => self.add_lane(LaneKind::Video, cx), |
| 921 | 936 | ActionId::AddAudioLane => self.add_lane(LaneKind::Audio, cx), |
| @@ -1039,6 +1054,26 @@ impl Player { | ||
| 1039 | 1054 | cx.notify(); |
| 1040 | 1055 | } |
| 1041 | 1056 | |
| 1057 | + /// Magnifies the timeline about a point that stays put: `anchor` is where | |
| 1058 | + /// along the bed to hold still (a ctrl+wheel holds the pointer), and with | |
| 1059 | + /// none it is the playhead -- so the frame being worked on is still the | |
| 1060 | + /// frame on screen after the zoom. Clamped at both ends by [`View`]: out | |
| 1061 | + /// stops at the whole timeline, in at a handful of frames. | |
| 1062 | + fn zoom(&mut self, factor: f32, anchor: Option<f32>, cx: &mut Context<Self>) { | |
| 1063 | + let duration = self.drawn_duration(); | |
| 1064 | + let at = self.playhead(duration); | |
| 1065 | + let anchor = anchor.unwrap_or_else(|| self.view.frac_at(at, duration).clamp(0., 1.)); | |
| 1066 | + self.view = self.view.zoomed(factor, anchor, duration, self.fps); | |
| 1067 | + cx.notify(); | |
| 1068 | + } | |
| 1069 | + | |
| 1070 | + /// All the way back out: the whole timeline across the bed, which is what | |
| 1071 | + /// the panel shows before anyone has zoomed at all. | |
| 1072 | + fn zoom_fit(&mut self, cx: &mut Context<Self>) { | |
| 1073 | + self.view = View::default(); | |
| 1074 | + cx.notify(); | |
| 1075 | + } | |
| 1076 | + | |
| 1042 | 1077 | /// Cycles the *project's* resolution through [`RESOLUTIONS`], starting from |
| 1043 | 1078 | /// the media's own -- the one size that must stay reachable, since a project |
| 1044 | 1079 | /// moved off it has no other way back (the resolution is not an undo step). |
| @@ -2108,14 +2143,16 @@ impl Player { | ||
| 2108 | 2143 | /// pointer exactly. |
| 2109 | 2144 | fn trim_to(&mut self, x: Pixels, cx: &mut Context<Self>) { |
| 2110 | 2145 | let (duration, fps) = (self.drawn_duration(), self.fps); |
| 2111 | - let frac = frac_along(x, self.ruler.get()); | |
| 2146 | + let at = self | |
| 2147 | + .view | |
| 2148 | + .time_at(frac_along(x, self.ruler.get()), duration); | |
| 2112 | 2149 | let (Some(trim), Some(session)) = (&mut self.trim, &self.session) else { |
| 2113 | 2150 | return; |
| 2114 | 2151 | }; |
| 2115 | 2152 | let Some((lo, hi)) = session.trim_room(trim.lane, trim.idx, trim.edge) else { |
| 2116 | 2153 | return; |
| 2117 | 2154 | }; |
| 2118 | - trim.to = frame_at(f64::from(frac) * duration, fps).clamp(lo, hi); | |
| 2155 | + trim.to = frame_at(at, fps).clamp(lo, hi); | |
| 2119 | 2156 | cx.notify(); |
| 2120 | 2157 | } |
| 2121 | 2158 | |
| @@ -2201,6 +2238,21 @@ impl Player { | ||
| 2201 | 2238 | } |
| 2202 | 2239 | } |
| 2203 | 2240 | |
| 2241 | + /// Where the playhead is, as the panel draws it. The clock keeps running | |
| 2242 | + /// after the last frame (wall time takes over at audio EOF) while the | |
| 2243 | + /// picture is frozen, so what the UI shows is the clamped one, pinned to | |
| 2244 | + /// the out-point once playback is done. | |
| 2245 | + fn playhead(&self, duration: f64) -> f64 { | |
| 2246 | + if self.done { | |
| 2247 | + duration | |
| 2248 | + } else { | |
| 2249 | + self.session | |
| 2250 | + .as_ref() | |
| 2251 | + .map_or(0., PlaybackSession::now) | |
| 2252 | + .clamp(0., duration) | |
| 2253 | + } | |
| 2254 | + } | |
| 2255 | + | |
| 2204 | 2256 | /// The one way a library row reaches the timeline: the Add button and a row |
| 2205 | 2257 | /// dragged onto a lane both come here, so there is a single answer to what |
| 2206 | 2258 | /// "add this source" does. The whole source goes in at the playhead as one |
| @@ -2657,7 +2709,9 @@ impl Player { | ||
| 2657 | 2709 | let Some(session) = &self.session else { |
| 2658 | 2710 | return; |
| 2659 | 2711 | }; |
| 2660 | - let t = f64::from(frac_along(x, self.ruler.get())) * session.timeline_duration(); | |
| 2712 | + let t = self | |
| 2713 | + .view | |
| 2714 | + .time_at(frac_along(x, self.ruler.get()), session.timeline_duration()); | |
| 2661 | 2715 | let target = (t * self.fps) as u32; |
| 2662 | 2716 | if commit || scrub_due(target, self.last_target, self.last_scrub.elapsed()) { |
| 2663 | 2717 | self.last_target = target; |
| @@ -2927,17 +2981,12 @@ impl Render for Player { | ||
| 2927 | 2981 | // timecode, the ruler and the clamp below all have to follow it -- and |
| 2928 | 2982 | // so does the room a tail being dragged needs to grow into. |
| 2929 | 2983 | let duration = self.drawn_duration(); |
| 2930 | - // The clock keeps running after the last frame (wall time takes over at | |
| 2931 | - // audio EOF) while the picture is frozen, so the timeline the UI shows is | |
| 2932 | - // the clamped one, pinned to the out-point once playback is done. | |
| 2933 | - let position = if self.done { | |
| 2934 | - duration | |
| 2935 | - } else { | |
| 2936 | - self.session | |
| 2937 | - .as_ref() | |
| 2938 | - .map_or(0., PlaybackSession::now) | |
| 2939 | - .clamp(0., duration) | |
| 2940 | - }; | |
| 2984 | + let position = self.playhead(duration); | |
| 2985 | + // Re-settled every frame against the duration this one is drawing: an | |
| 2986 | + // edit that shortens the timeline moves the far end of the view, and a | |
| 2987 | + // playhead that has run off the bed pulls the view after it -- which is | |
| 2988 | + // what makes a zoomed-in timeline scroll while it plays. | |
| 2989 | + self.view = self.view.following(position, duration, self.fps); | |
| 2941 | 2990 | |
| 2942 | 2991 | div() |
| 2943 | 2992 | .track_focus(&self.focus) |
| @@ -3638,11 +3687,11 @@ impl Player { | ||
| 3638 | 3687 | playing: bool, |
| 3639 | 3688 | cx: &mut Context<Self>, |
| 3640 | 3689 | ) -> impl IntoElement { |
| 3641 | - let filled = if duration > 0. { | |
| 3642 | - (position / duration) as f32 | |
| 3643 | - } else { | |
| 3644 | - 0. | |
| 3645 | - }; | |
| 3690 | + // Where the playhead is *on the bed*, which at the fit is where along | |
| 3691 | + // the timeline it is and zoomed in is where along the visible slice. | |
| 3692 | + // Clamped because it is drawn as a width as well as an offset, and the | |
| 3693 | + // view follows the playhead anyway, so it is never off the bed. | |
| 3694 | + let filled = self.view.frac_at(position, duration).clamp(0., 1.); | |
| 3646 | 3695 | // An export owns the hint slot and the ruler while it runs: the |
| 3647 | 3696 | // percentage and the accent bar are the same number, so the playhead |
| 3648 | 3697 | // fill doubles as the progress bar for free. |
| @@ -3846,6 +3895,51 @@ impl Player { | ||
| 3846 | 3895 | live, |
| 3847 | 3896 | cx.listener(|this, _: &ClickEvent, _, cx| this.cycle_resolution(cx)), |
| 3848 | 3897 | )) |
| 3898 | + // How much of the timeline the panel below is showing -- | |
| 3899 | + // beside the resolution, since neither of them edits | |
| 3900 | + // anything: they are both what is being looked at. The | |
| 3901 | + // middle one reads as the state (1.0x is the whole | |
| 3902 | + // timeline) and is the way back to it. | |
| 3903 | + .child(control( | |
| 3904 | + "zoom-out", | |
| 3905 | + None, | |
| 3906 | + "−", | |
| 3907 | + format!( | |
| 3908 | + "{} — show more of the timeline; stops at the whole of it", | |
| 3909 | + key(ActionId::ZoomOut) | |
| 3910 | + ), | |
| 3911 | + live, | |
| 3912 | + cx.listener(|this, _: &ClickEvent, _, cx| { | |
| 3913 | + this.zoom(1. / ZOOM_STEP, None, cx) | |
| 3914 | + }), | |
| 3915 | + )) | |
| 3916 | + .child(control( | |
| 3917 | + "zoom-fit", | |
| 3918 | + None, | |
| 3919 | + format!("{:.1}x", self.view.zoom), | |
| 3920 | + format!( | |
| 3921 | + "{} — fit the whole timeline; showing {} to {}", | |
| 3922 | + key(ActionId::ZoomFit), | |
| 3923 | + timecode(self.view.start, self.fps), | |
| 3924 | + timecode( | |
| 3925 | + (self.view.start + self.view.span(duration)).min(duration), | |
| 3926 | + self.fps | |
| 3927 | + ) | |
| 3928 | + ), | |
| 3929 | + live, | |
| 3930 | + cx.listener(|this, _: &ClickEvent, _, cx| this.zoom_fit(cx)), | |
| 3931 | + )) | |
| 3932 | + .child(control( | |
| 3933 | + "zoom-in", | |
| 3934 | + None, | |
| 3935 | + "+", | |
| 3936 | + format!( | |
| 3937 | + "{} — magnify around the playhead; ctrl+wheel on the bar zooms at the pointer", | |
| 3938 | + key(ActionId::ZoomIn) | |
| 3939 | + ), | |
| 3940 | + live, | |
| 3941 | + cx.listener(|this, _: &ClickEvent, _, cx| this.zoom(ZOOM_STEP, None, cx)), | |
| 3942 | + )) | |
| 3849 | 3943 | // Import is not here: it belongs to the media list it adds |
| 3850 | 3944 | // to, and two doors into one action is a question about |
| 3851 | 3945 | // which one is the real one. |
| @@ -3958,7 +4052,32 @@ impl Player { | ||
| 3958 | 4052 | .hover(|s| s.bg(rgb(HOVER_DIM))) |
| 3959 | 4053 | // The strip carries no text, so the tooltip is the only |
| 3960 | 4054 | // place it can say what it is. |
| 3961 | - .tooltip(|_, cx| cx.new(|_| Tip("Seek — click or drag".into())).into()) | |
| 4055 | + .tooltip(|_, cx| { | |
| 4056 | + cx.new(|_| Tip("Seek — click or drag; ctrl+wheel zooms".into())) | |
| 4057 | + .into() | |
| 4058 | + }) | |
| 4059 | + // Ctrl+wheel is what every timeline zooms with, and | |
| 4060 | + // the point held still is the one under the pointer | |
| 4061 | + // rather than the playhead. Only with ctrl: a bare | |
| 4062 | + // wheel here is the window's to scroll, and the | |
| 4063 | + // controls row above scrolls on exactly that. | |
| 4064 | + .on_scroll_wheel(cx.listener( | |
| 4065 | + |this, event: &ScrollWheelEvent, _, cx| { | |
| 4066 | + if !event.modifiers.control { | |
| 4067 | + return; | |
| 4068 | + } | |
| 4069 | + let dy = match event.delta { | |
| 4070 | + ScrollDelta::Lines(d) => d.y, | |
| 4071 | + ScrollDelta::Pixels(d) => f32::from(d.y), | |
| 4072 | + }; | |
| 4073 | + if dy == 0. { | |
| 4074 | + return; | |
| 4075 | + } | |
| 4076 | + let anchor = frac_along(event.position.x, this.ruler.get()); | |
| 4077 | + let factor = if dy > 0. { ZOOM_STEP } else { 1. / ZOOM_STEP }; | |
| 4078 | + this.zoom(factor, Some(anchor), cx); | |
| 4079 | + }, | |
| 4080 | + )) | |
| 3962 | 4081 | .on_mouse_down( |
| 3963 | 4082 | MouseButton::Left, |
| 3964 | 4083 | cx.listener(|this, event: &MouseDownEvent, _, cx| { |
| @@ -5550,6 +5669,9 @@ impl Player { | ||
| 5550 | 5669 | // one probe answers for both. Zero before the first paint, which only |
| 5551 | 5670 | // costs the labels one frame. |
| 5552 | 5671 | let bed_w = f32::from(self.ruler.get().size.width); |
| 5672 | + // The slice being shown, copied out once: every box in the row is | |
| 5673 | + // placed through it, so all of them move together when it does. | |
| 5674 | + let view = self.view; | |
| 5553 | 5675 | let clips = self |
| 5554 | 5676 | .session |
| 5555 | 5677 | .as_ref() |
| @@ -5687,7 +5809,7 @@ impl Player { | ||
| 5687 | 5809 | .and_then(|s| sources.iter().position(|o| o.path == s.path)) |
| 5688 | 5810 | .unwrap_or(clip.source), |
| 5689 | 5811 | ); |
| 5690 | - let width = width_frac(len, duration); | |
| 5812 | + let width = view.width_frac(len, duration); | |
| 5691 | 5813 | let label = sources.get(clip.source).map(|s| file_name(&s.path)); |
| 5692 | 5814 | let wave = sources |
| 5693 | 5815 | .get(clip.source) |
| @@ -5711,7 +5833,11 @@ impl Player { | ||
| 5711 | 5833 | .absolute() |
| 5712 | 5834 | .top_0() |
| 5713 | 5835 | .h_full() |
| 5714 | - .left(relative(start_frac(start, duration))) | |
| 5836 | + // Negative once the clip's head has been scrolled | |
| 5837 | + // off the left edge: the bed clips what hangs out | |
| 5838 | + // of it, so a half-visible clip is drawn as the | |
| 5839 | + // half of itself that is on screen. | |
| 5840 | + .left(relative(view.frac_at(start, duration))) | |
| 5715 | 5841 | .w(relative(width)) |
| 5716 | 5842 | .overflow_hidden() |
| 5717 | 5843 | .rounded(px(3.)) |
| @@ -5860,8 +5986,12 @@ impl Player { | ||
| 5860 | 5986 | .absolute() |
| 5861 | 5987 | .top_0() |
| 5862 | 5988 | .h_full() |
| 5863 | - .left(relative(start_frac(f64::from(at) / self.fps, duration))) | |
| 5864 | - .w(relative(width_frac(f64::from(len) / self.fps, duration))) | |
| 5989 | + .left(relative( | |
| 5990 | + view.frac_at(f64::from(at) / self.fps, duration), | |
| 5991 | + )) | |
| 5992 | + .w(relative( | |
| 5993 | + view.width_frac(f64::from(len) / self.fps, duration), | |
| 5994 | + )) | |
| 5865 | 5995 | .bg(rgba(0x4a9effaa)) |
| 5866 | 5996 | }), |
| 5867 | 5997 | ) |
| @@ -6691,7 +6821,18 @@ enum Repeat { | ||
| 6691 | 6821 | fn repeats(scope: Repeat, key: &str, action: Option<ActionId>) -> bool { |
| 6692 | 6822 | match scope { |
| 6693 | 6823 | Repeat::Card => matches!(key, "up" | "down" | "left" | "right"), |
| 6694 | - Repeat::Keymap => matches!(action, Some(ActionId::VolumeUp | ActionId::VolumeDown)), | |
| 6824 | + Repeat::Keymap => matches!( | |
| 6825 | + action, | |
| 6826 | + Some( | |
| 6827 | + ActionId::VolumeUp | |
| 6828 | + | ActionId::VolumeDown | |
| 6829 | + // A zoom is a value being moved as much as a level is: | |
| 6830 | + // held, it runs from the whole timeline down to a handful | |
| 6831 | + // of frames and stops there. The fit is one press. | |
| 6832 | + | ActionId::ZoomIn | |
| 6833 | + | ActionId::ZoomOut | |
| 6834 | + ) | |
| 6835 | + ), | |
| 6695 | 6836 | Repeat::Nothing => false, |
| 6696 | 6837 | } |
| 6697 | 6838 | } |
| @@ -6789,14 +6930,127 @@ fn width_frac(len: f64, total: f64) -> f32 { | ||
| 6789 | 6930 | if total > 0. { (len / total) as f32 } else { 1. } |
| 6790 | 6931 | } |
| 6791 | 6932 | |
| 6792 | -/// Where along the lane a clip starts, 0..1. Unlike [`width_frac`] a timeline | |
| 6793 | -/// with no length pins this to the left edge -- a full-width offset would push | |
| 6794 | -/// the box out of the lane it belongs to. | |
| 6795 | -fn start_frac(start: f64, total: f64) -> f32 { | |
| 6796 | - if total > 0. { | |
| 6797 | - (start / total).clamp(0., 1.) as f32 | |
| 6798 | - } else { | |
| 6799 | - 0. | |
| 6933 | +/// One press of a zoom key, or one notch of ctrl+wheel. | |
| 6934 | +const ZOOM_STEP: f32 = 1.25; | |
| 6935 | + | |
| 6936 | +/// How few frames the bed may be narrowed down to. Past this there is nothing | |
| 6937 | +/// left to aim at -- a single frame across a whole window is a wall of colour, | |
| 6938 | +/// not an edit surface. | |
| 6939 | +const ZOOM_MIN_FRAMES: f64 = 8.; | |
| 6940 | + | |
| 6941 | +/// Which slice of the timeline the ruler and the lanes are showing: `zoom` is | |
| 6942 | +/// how many times the whole of it the bed is now worth, and `start` the moment | |
| 6943 | +/// at the bed's left edge. The one place frames become pixels -- every box, the | |
| 6944 | +/// playhead, a seek and a trim all go through it, so none of them can drift | |
| 6945 | +/// away from the others when the view moves. | |
| 6946 | +/// | |
| 6947 | +/// [`View::default`] is the whole timeline across the bed, which is what the | |
| 6948 | +/// panel drew before there was a zoom at all: at zoom 1 `start` is pinned to 0 | |
| 6949 | +/// and every fraction here is the one [`width_frac`] and `start_frac` gave. | |
| 6950 | +#[derive(Clone, Copy, Debug, PartialEq)] | |
| 6951 | +struct View { | |
| 6952 | + zoom: f32, | |
| 6953 | + start: f64, | |
| 6954 | +} | |
| 6955 | + | |
| 6956 | +impl Default for View { | |
| 6957 | + fn default() -> Self { | |
| 6958 | + View { | |
| 6959 | + zoom: 1., | |
| 6960 | + start: 0., | |
| 6961 | + } | |
| 6962 | + } | |
| 6963 | +} | |
| 6964 | + | |
| 6965 | +impl View { | |
| 6966 | + /// How much of the timeline is on the bed, in seconds. | |
| 6967 | + fn span(self, duration: f64) -> f64 { | |
| 6968 | + duration / f64::from(self.zoom) | |
| 6969 | + } | |
| 6970 | + | |
| 6971 | + /// The tightest this timeline may be zoomed: [`ZOOM_MIN_FRAMES`] across the | |
| 6972 | + /// bed. Never under 1 -- a timeline shorter than that is already at its | |
| 6973 | + /// floor, and a zoom that cannot fit the whole of it is not a zoom. | |
| 6974 | + fn max_zoom(duration: f64, fps: f64) -> f32 { | |
| 6975 | + let frames = duration * fps; | |
| 6976 | + if frames > ZOOM_MIN_FRAMES { | |
| 6977 | + (frames / ZOOM_MIN_FRAMES) as f32 | |
| 6978 | + } else { | |
| 6979 | + 1. | |
| 6980 | + } | |
| 6981 | + } | |
| 6982 | + | |
| 6983 | + /// Where a moment sits along the bed, 0 at its left edge and 1 at its | |
| 6984 | + /// right. Outside that range for a moment scrolled off the view, which is | |
| 6985 | + /// exactly the negative offset a half-visible clip is drawn at. | |
| 6986 | + fn frac_at(self, at: f64, duration: f64) -> f32 { | |
| 6987 | + let span = self.span(duration); | |
| 6988 | + if span > 0. { | |
| 6989 | + ((at - self.start) / span) as f32 | |
| 6990 | + } else { | |
| 6991 | + 0. | |
| 6992 | + } | |
| 6993 | + } | |
| 6994 | + | |
| 6995 | + /// How wide a stretch of `len` seconds is on the bed. More than the whole | |
| 6996 | + /// bed once zoomed in, which is the point of zooming in. | |
| 6997 | + fn width_frac(self, len: f64, duration: f64) -> f32 { | |
| 6998 | + width_frac(len, self.span(duration)) | |
| 6999 | + } | |
| 7000 | + | |
| 7001 | + /// The moment a pointer at `frac` along the bed is pointing at: the inverse | |
| 7002 | + /// of [`View::frac_at`], and what every seek and every trim reads. | |
| 7003 | + fn time_at(self, frac: f32, duration: f64) -> f64 { | |
| 7004 | + (self.start + f64::from(frac) * self.span(duration)).clamp(0., duration) | |
| 7005 | + } | |
| 7006 | + | |
| 7007 | + /// Zoomed by `factor` about `anchor` (0..1 along the bed): whatever moment | |
| 7008 | + /// was under that point stays under it, so a zoom magnifies what was being | |
| 7009 | + /// looked at rather than throwing it off the edge. | |
| 7010 | + fn zoomed(self, factor: f32, anchor: f32, duration: f64, fps: f64) -> Self { | |
| 7011 | + let at = self.start + f64::from(anchor) * self.span(duration); | |
| 7012 | + // Clamped *before* the offset is worked out, not after: a press that | |
| 7013 | + // runs into either stop must still leave the anchor where it is, and a | |
| 7014 | + // start measured against a zoom the stop then took away would slide it. | |
| 7015 | + let zoom = (self.zoom * factor).clamp(1., Self::max_zoom(duration, fps)); | |
| 7016 | + let start = at - f64::from(anchor) * View { zoom, start: 0. }.span(duration); | |
| 7017 | + View { zoom, start }.settled(duration, fps) | |
| 7018 | + } | |
| 7019 | + | |
| 7020 | + /// Clamped to the timeline it draws: never wider than the whole of it (the | |
| 7021 | + /// zoom-out floor is the fit), never tighter than [`View::max_zoom`], and | |
| 7022 | + /// never scrolled past either end. | |
| 7023 | + fn settled(self, duration: f64, fps: f64) -> Self { | |
| 7024 | + let zoom = if self.zoom.is_finite() { | |
| 7025 | + self.zoom.clamp(1., Self::max_zoom(duration, fps)) | |
| 7026 | + } else { | |
| 7027 | + 1. | |
| 7028 | + }; | |
| 7029 | + let span = View { zoom, start: 0. }.span(duration); | |
| 7030 | + let start = if self.start.is_finite() { | |
| 7031 | + self.start.clamp(0., (duration - span).max(0.)) | |
| 7032 | + } else { | |
| 7033 | + 0. | |
| 7034 | + }; | |
| 7035 | + View { zoom, start } | |
| 7036 | + } | |
| 7037 | + | |
| 7038 | + /// The view a playhead at `at` needs: the same one while it is on the bed, | |
| 7039 | + /// and one centred on it once it has run off -- which is how a zoomed-in | |
| 7040 | + /// timeline scrolls, during playback and after a seek alike. At the fit | |
| 7041 | + /// this can never fire, so an unzoomed panel is untouched by it. | |
| 7042 | + fn following(self, at: f64, duration: f64, fps: f64) -> Self { | |
| 7043 | + let view = self.settled(duration, fps); | |
| 7044 | + let span = view.span(duration); | |
| 7045 | + if at < view.start || at > view.start + span { | |
| 7046 | + View { | |
| 7047 | + start: at - span / 2., | |
| 7048 | + ..view | |
| 7049 | + } | |
| 7050 | + .settled(duration, fps) | |
| 7051 | + } else { | |
| 7052 | + view | |
| 7053 | + } | |
| 6800 | 7054 | } |
| 6801 | 7055 | } |
| 6802 | 7056 | |
| @@ -7465,10 +7719,13 @@ mod tests { | ||
| 7465 | 7719 | export_settings, format_key, format_line, format_refusal, frac_along, frac_down, frame_at, |
| 7466 | 7720 | histogram, is_bare_modifier, is_project, keymap, lanes_h, marked, menu_at, normalise, |
| 7467 | 7721 | nothing_to_play, panel_h, project_path, push_digit, retarget, scrub_due, show_label, |
| 7468 | - silence_rate, source_tint, span_partner, speed_at, start_frac, timecode, unseen_paths, | |
| 7469 | - unseen_sources, whole_take, width_frac, window_title, | |
| 7722 | + silence_rate, source_tint, span_partner, speed_at, timecode, unseen_paths, unseen_sources, | |
| 7723 | + whole_take, width_frac, window_title, | |
| 7724 | + }; | |
| 7725 | + use super::{ | |
| 7726 | + LaneKind, Repeat, View, ZOOM_MIN_FRAMES, ZOOM_STEP, file_name, file_uri, library_rows, | |
| 7727 | + repeats, unscannable, | |
| 7470 | 7728 | }; |
| 7471 | - use super::{LaneKind, Repeat, file_name, file_uri, library_rows, repeats, unscannable}; | |
| 7472 | 7729 | |
| 7473 | 7730 | /// What the file manager is handed: the parts a path keeps as they are, and |
| 7474 | 7731 | /// the ones the bus would otherwise read as something else. |
| @@ -7856,6 +8113,10 @@ mod tests { | ||
| 7856 | 8113 | ActionId::Save => element("save"), |
| 7857 | 8114 | ActionId::Undo => element("undo"), |
| 7858 | 8115 | ActionId::Resolution => element("resolution"), |
| 8116 | + // Three buttons beside it, and the ctrl+wheel on the bar. | |
| 8117 | + ActionId::ZoomIn => element("zoom-in"), | |
| 8118 | + ActionId::ZoomOut => element("zoom-out"), | |
| 8119 | + ActionId::ZoomFit => element("zoom-fit"), | |
| 7859 | 8120 | ActionId::AddVideoLane => element("add-video-lane"), |
| 7860 | 8121 | ActionId::AddAudioLane => element("add-audio-lane"), |
| 7861 | 8122 | // The × in a lane's own header, which takes any track and |
| @@ -8576,6 +8837,161 @@ mod tests { | ||
| 8576 | 8837 | } |
| 8577 | 8838 | } |
| 8578 | 8839 | |
| 8840 | + /// The mapping the whole panel is drawn and clicked through: a moment goes | |
| 8841 | + /// to a fraction of the bed and comes back the same moment, at every zoom. | |
| 8842 | + /// The fit is the invariant that matters most -- it must be the arithmetic | |
| 8843 | + /// the panel did before there was a zoom at all. | |
| 8844 | + #[test] | |
| 8845 | + fn a_moment_and_the_place_it_is_drawn_are_the_same_at_every_zoom() { | |
| 8846 | + let duration = 20.; | |
| 8847 | + // The fit: what `start_frac`/`width_frac` used to answer, exactly. | |
| 8848 | + let fit = View::default(); | |
| 8849 | + for t in [0., 5., 12.5, 20.] { | |
| 8850 | + assert_eq!(fit.frac_at(t, duration), (t / duration) as f32, "fit at {t}"); | |
| 8851 | + } | |
| 8852 | + assert_eq!(fit.width_frac(5., duration), width_frac(5., duration)); | |
| 8853 | + for view in [ | |
| 8854 | + fit, | |
| 8855 | + View { | |
| 8856 | + zoom: 2., | |
| 8857 | + start: 4., | |
| 8858 | + }, | |
| 8859 | + View { | |
| 8860 | + zoom: 8., | |
| 8861 | + start: 12.5, | |
| 8862 | + }, | |
| 8863 | + View { | |
| 8864 | + zoom: 37.5, | |
| 8865 | + start: 19., | |
| 8866 | + }, | |
| 8867 | + ] { | |
| 8868 | + let view = view.settled(duration, 30.); | |
| 8869 | + for frac in [0., 0.25, 0.5, 1.] { | |
| 8870 | + let at = view.time_at(frac, duration); | |
| 8871 | + assert!( | |
| 8872 | + (f64::from(view.frac_at(at, duration)) - f64::from(frac)).abs() < 1e-6, | |
| 8873 | + "{view:?} round trip at {frac}" | |
| 8874 | + ); | |
| 8875 | + } | |
| 8876 | + // A stretch is as wide as the share of the visible slice it takes. | |
| 8877 | + assert!( | |
| 8878 | + (f64::from(view.width_frac(view.span(duration), duration)) - 1.).abs() < 1e-6, | |
| 8879 | + "{view:?} spans the bed" | |
| 8880 | + ); | |
| 8881 | + } | |
| 8882 | + } | |
| 8883 | + | |
| 8884 | + /// The rule that makes a zoom usable: whatever was under the anchor is | |
| 8885 | + /// still under it afterwards -- the playhead for a key, the pointer for a | |
| 8886 | + /// ctrl+wheel. | |
| 8887 | + #[test] | |
| 8888 | + fn a_zoom_leaves_the_anchor_where_it_was_on_screen() { | |
| 8889 | + let (duration, fps) = (20., 30.); | |
| 8890 | + let mut view = View::default(); | |
| 8891 | + for anchor in [0.5f32, 0.25, 0.9] { | |
| 8892 | + // Well past the zoom-in stop: the anchor holds at the clamp too, | |
| 8893 | + // which is where it used to slide (the clamp came after the offset). | |
| 8894 | + for _ in 0..30 { | |
| 8895 | + let at = view.time_at(anchor, duration); | |
| 8896 | + let zoomed = view.zoomed(ZOOM_STEP, anchor, duration, fps); | |
| 8897 | + // Only where the anchor is not pinned by an edge of the | |
| 8898 | + // timeline: a view already against an end cannot slide further. | |
| 8899 | + let pinned = zoomed.start <= 0. || zoomed.start + zoomed.span(duration) >= duration; | |
| 8900 | + if !pinned { | |
| 8901 | + assert!( | |
| 8902 | + (f64::from(zoomed.frac_at(at, duration)) - f64::from(anchor)).abs() < 1e-6, | |
| 8903 | + "{at} moved: {view:?} -> {zoomed:?}" | |
| 8904 | + ); | |
| 8905 | + } | |
| 8906 | + assert!(zoomed.zoom >= view.zoom, "and it did zoom in"); | |
| 8907 | + view = zoomed; | |
| 8908 | + } | |
| 8909 | + } | |
| 8910 | + } | |
| 8911 | + | |
| 8912 | + /// Both stops: out is the whole timeline (which is where the panel starts, | |
| 8913 | + /// so nothing regressed for anyone who never zooms), in is a handful of | |
| 8914 | + /// frames -- and neither can scroll off an end. | |
| 8915 | + #[test] | |
| 8916 | + fn zoom_stops_at_the_whole_timeline_and_at_a_handful_of_frames() { | |
| 8917 | + let (duration, fps) = (20., 30.); | |
| 8918 | + let mut view = View::default(); | |
| 8919 | + for _ in 0..200 { | |
| 8920 | + view = view.zoomed(1. / ZOOM_STEP, 0.5, duration, fps); | |
| 8921 | + } | |
| 8922 | + assert_eq!(view, View::default(), "zoomed out is the fit"); | |
| 8923 | + for _ in 0..200 { | |
| 8924 | + view = view.zoomed(ZOOM_STEP, 0.5, duration, fps); | |
| 8925 | + } | |
| 8926 | + assert_eq!( | |
| 8927 | + (view.span(duration) * fps).round(), | |
| 8928 | + ZOOM_MIN_FRAMES, | |
| 8929 | + "tightest is a handful of frames" | |
| 8930 | + ); | |
| 8931 | + // Against the far end, the slice still ends at the last frame. | |
| 8932 | + let end = View { | |
| 8933 | + zoom: view.zoom, | |
| 8934 | + start: 1e6, | |
| 8935 | + } | |
| 8936 | + .settled(duration, fps); | |
| 8937 | + assert!((end.start + end.span(duration) - duration).abs() < 1e-9); | |
| 8938 | + assert!( | |
| 8939 | + View { | |
| 8940 | + zoom: view.zoom, | |
| 8941 | + start: -5. | |
| 8942 | + } | |
| 8943 | + .settled(duration, fps) | |
| 8944 | + .start | |
| 8945 | + == 0. | |
| 8946 | + ); | |
| 8947 | + // A timeline too short to zoom into, and one with no length at all, | |
| 8948 | + // both stay at the fit rather than dividing by nothing. | |
| 8949 | + assert_eq!(View::max_zoom(0.1, fps), 1.); | |
| 8950 | + assert_eq!(View::default().settled(0., fps), View::default()); | |
| 8951 | + assert_eq!(View::default().frac_at(3., 0.), 0.); | |
| 8952 | + assert_eq!(View::default().time_at(0.5, 0.), 0.); | |
| 8953 | + } | |
| 8954 | + | |
| 8955 | + /// What makes a zoomed timeline follow the playing head: off the bed at | |
| 8956 | + /// either end pulls the view onto it, and on the bed it never moves -- a | |
| 8957 | + /// view that jumped every frame would be unreadable. | |
| 8958 | + #[test] | |
| 8959 | + fn the_view_follows_a_playhead_that_runs_off_the_bed() { | |
| 8960 | + let (duration, fps) = (20., 30.); | |
| 8961 | + let view = View { | |
| 8962 | + zoom: 4., | |
| 8963 | + start: 5., | |
| 8964 | + } | |
| 8965 | + .settled(duration, fps); | |
| 8966 | + assert_eq!(view.span(duration), 5.); | |
| 8967 | + // Inside: untouched, whichever part of the slice it is in. | |
| 8968 | + for at in [5., 7.5, 10.] { | |
| 8969 | + assert_eq!(view.following(at, duration, fps), view, "{at} is on the bed"); | |
| 8970 | + } | |
| 8971 | + // Past the right edge, as playback does it: the head comes back on the | |
| 8972 | + // bed, and the zoom is not changed by the scroll. | |
| 8973 | + let moved = view.following(12., duration, fps); | |
| 8974 | + assert_eq!(moved.zoom, view.zoom); | |
| 8975 | + assert!(moved.start > view.start, "scrolled forward"); | |
| 8976 | + assert!( | |
| 8977 | + moved.frac_at(12., duration) > 0. && moved.frac_at(12., duration) < 1., | |
| 8978 | + "and the playhead is on screen" | |
| 8979 | + ); | |
| 8980 | + // A seek back behind the slice does the same the other way. | |
| 8981 | + let back = view.following(1., duration, fps); | |
| 8982 | + assert!(back.start < view.start); | |
| 8983 | + assert!(back.frac_at(1., duration) >= 0.); | |
| 8984 | + // At the fit there is nothing to follow: the whole timeline is on the | |
| 8985 | + // bed already, so no playhead can move it. | |
| 8986 | + for at in [0., 10., 20.] { | |
| 8987 | + assert_eq!( | |
| 8988 | + View::default().following(at, duration, fps), | |
| 8989 | + View::default(), | |
| 8990 | + "the fit never scrolls" | |
| 8991 | + ); | |
| 8992 | + } | |
| 8993 | + } | |
| 8994 | + | |
| 8579 | 8995 | #[test] |
| 8580 | 8996 | fn clip_boxes_split_the_lane_by_duration() { |
| 8581 | 8997 | // 1 s + 3 s of a 4 s timeline: a quarter and three quarters. |
| @@ -9158,11 +9574,20 @@ mod tests { | ||
| 9158 | 9574 | // value being moved. |
| 9159 | 9575 | assert!(repeats(Repeat::Keymap, "up", Some(ActionId::VolumeUp))); |
| 9160 | 9576 | assert!(repeats(Repeat::Keymap, "down", Some(ActionId::VolumeDown))); |
| 9577 | + // ...and the zoom pair, which runs the view the way they run the level. | |
| 9578 | + assert!(repeats(Repeat::Keymap, "=", Some(ActionId::ZoomIn))); | |
| 9579 | + assert!(!repeats(Repeat::Keymap, "0", Some(ActionId::ZoomFit))); | |
| 9161 | 9580 | for action in ActionId::ALL { |
| 9162 | 9581 | let held = repeats(Repeat::Keymap, "k", Some(action)); |
| 9163 | 9582 | assert_eq!( |
| 9164 | 9583 | held, |
| 9165 | - matches!(action, ActionId::VolumeUp | ActionId::VolumeDown), | |
| 9584 | + matches!( | |
| 9585 | + action, | |
| 9586 | + ActionId::VolumeUp | |
| 9587 | + | ActionId::VolumeDown | |
| 9588 | + | ActionId::ZoomIn | |
| 9589 | + | ActionId::ZoomOut | |
| 9590 | + ), | |
| 9166 | 9591 | "{action:?} on a hold" |
| 9167 | 9592 | ); |
| 9168 | 9593 | } |
| @@ -9386,10 +9811,9 @@ mod tests { | ||
| 9386 | 9811 | assert!(show_label(400.)); |
| 9387 | 9812 | assert!(!show_label(LABEL_MIN_W - 0.1)); |
| 9388 | 9813 | // A timeline with no length must not put a box outside its lane. |
| 9389 | - assert_eq!(start_frac(3., 0.), 0.); | |
| 9390 | - assert_eq!(start_frac(1., 4.), 0.25); | |
| 9391 | - // Past the end clamps rather than running off the bed. | |
| 9392 | - assert_eq!(start_frac(8., 4.), 1.); | |
| 9814 | + let fit = View::default(); | |
| 9815 | + assert_eq!(fit.frac_at(3., 0.), 0.); | |
| 9816 | + assert_eq!(fit.frac_at(1., 4.), 0.25); | |
| 9393 | 9817 | } |
| 9394 | 9818 | |
| 9395 | 9819 | #[test] |
| @@ -9754,6 +10178,9 @@ fn main() { | ||
| 9754 | 10178 | eos: false, |
| 9755 | 10179 | done: false, |
| 9756 | 10180 | ruler: Rc::default(), |
| 10181 | + // The whole timeline across the bed, which is where a | |
| 10182 | + // project opens: zooming is something the user asks for. | |
| 10183 | + view: View::default(), | |
| 9757 | 10184 | selected: None, |
| 9758 | 10185 | context_menu: None, |
| 9759 | 10186 | library_menu: None, |