The subtitle strip answers the wheel like the lanes
Browse files at this commit0e324ec6929f6c34f6fc2c5d0b7b10c641bc06f9Parent: 8a5f18b- feat
- the subtitle strip answers the wheel like the lanes
1 changed file +15 -2
crates/app/src/ui/timeline.rsmodified+15 -2
| @@ -43,7 +43,7 @@ impl Player { | ||
| 43 | 43 | // Built from the same playhead pixel the lanes are, and before the |
| 44 | 44 | // export takes `filled` over below: the strip is a picture of the |
| 45 | 45 | // timeline, not of an export's progress. |
| 46 | - let strip = self.subtitle_strip(filled); | |
| 46 | + let strip = self.subtitle_strip(filled, cx); | |
| 47 | 47 | let strip_h = subtitle_strip_h(strip.is_some()); |
| 48 | 48 | let (hint, filled) = if let Some(export) = self.exporting() { |
| 49 | 49 | let progress = export.progress(); |
| @@ -590,7 +590,11 @@ impl Player { | ||
| 590 | 590 | /// |
| 591 | 591 | /// `None` with no track picked, so a timeline without subtitles is the panel |
| 592 | 592 | /// it has always been. |
| 593 | - pub(crate) fn subtitle_strip(&self, filled: f32) -> Option<impl IntoElement + use<>> { | |
| 593 | + pub(crate) fn subtitle_strip( | |
| 594 | + &self, | |
| 595 | + filled: f32, | |
| 596 | + cx: &mut Context<Self>, | |
| 597 | + ) -> Option<impl IntoElement + use<>> { | |
| 594 | 598 | let track = self.subtitle_track()?; |
| 595 | 599 | let scale = self.scale; |
| 596 | 600 | // The pick with its film on it, not the raw tag: two films' "eng" |
| @@ -670,6 +674,15 @@ impl Player { | ||
| 670 | 674 | .rounded(px(3.)) |
| 671 | 675 | .bg(rgb(BG_TIMELINE())) |
| 672 | 676 | .overflow_hidden() |
| 677 | + // The same bed under the same [`Scale`] answers the same | |
| 678 | + // wheel ([`Player::timeline_wheel`]): ctrl zooms about | |
| 679 | + // the pointer, bare scrolls the view along. A hand that | |
| 680 | + // wants a cue closer aims at the cue, and a timeline | |
| 681 | + // surface that ignores the wheel is a dead one. | |
| 682 | + .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| { | |
| 683 | + cx.stop_propagation(); | |
| 684 | + this.timeline_wheel(event, cx); | |
| 685 | + })) | |
| 673 | 686 | .children(cues.into_iter().map(|(left, width)| { |
| 674 | 687 | div() |
| 675 | 688 | .absolute() |