forge
Explore
Log in

Don't you dare go Hollow

The subtitle strip answers the wheel like the lanes

Browse files at this commit

0e324ec6929f6c34f6fc2c5d0b7b10c641bc06f9Ahmet Kaan GümüşParent: 8a5f18b
  • feat
    • the subtitle strip answers the wheel like the lanes
Show full message
✨ feat(timeline): the subtitle strip answers the wheel like the lanes

The strip under the tracks is drawn on the same bed, through the same
Scale, and a cue is exactly what a hand aims at when it wants to see a
line closer -- so it took the same wheel the ruler and the beds already
take: ctrl magnifies about the pointer, a bare notch slides the view
along. It ignored both until now, a dead surface in the middle of a live
panel.

Nothing occludes inside it -- the cue boxes and the playhead are plain
paint -- so the bed's own listener is the whole of it.
crates/app/src/ui/timeline.rsmodified+15 -2
@@ -43,7 +43,7 @@ impl Player {
43 // Built from the same playhead pixel the lanes are, and before the43 // Built from the same playhead pixel the lanes are, and before the
44 // export takes `filled` over below: the strip is a picture of the44 // export takes `filled` over below: the strip is a picture of the
45 // timeline, not of an export's progress.45 // timeline, not of an export's progress.
46- let strip = self.subtitle_strip(filled);46+ let strip = self.subtitle_strip(filled, cx);
47 let strip_h = subtitle_strip_h(strip.is_some());47 let strip_h = subtitle_strip_h(strip.is_some());
48 let (hint, filled) = if let Some(export) = self.exporting() {48 let (hint, filled) = if let Some(export) = self.exporting() {
49 let progress = export.progress();49 let progress = export.progress();
@@ -590,7 +590,11 @@ impl Player {
590 ///590 ///
591 /// `None` with no track picked, so a timeline without subtitles is the panel591 /// `None` with no track picked, so a timeline without subtitles is the panel
592 /// it has always been.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 let track = self.subtitle_track()?;598 let track = self.subtitle_track()?;
595 let scale = self.scale;599 let scale = self.scale;
596 // The pick with its film on it, not the raw tag: two films' "eng"600 // The pick with its film on it, not the raw tag: two films' "eng"
@@ -670,6 +674,15 @@ impl Player {
670 .rounded(px(3.))674 .rounded(px(3.))
671 .bg(rgb(BG_TIMELINE()))675 .bg(rgb(BG_TIMELINE()))
672 .overflow_hidden()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 .children(cues.into_iter().map(|(left, width)| {686 .children(cues.into_iter().map(|(left, width)| {
674 div()687 div()
675 .absolute()688 .absolute()