diff --git a/crates/app/src/player/titling.rs b/crates/app/src/player/titling.rs index b334302..0792447 100644 --- a/crates/app/src/player/titling.rs +++ b/crates/app/src/player/titling.rs @@ -475,7 +475,8 @@ impl Player { } /// Seeks the playhead to the next (`forward`) or the previous key of the selected title, and - /// says so when there is none that way. + /// says so when there is none that way. Keys past the title's last frame are held but never + /// reached; when the only keys ahead are such keys, the message says that instead. pub(crate) fn jump_title_key(&mut self, forward: bool, cx: &mut Context) { let Some((_, t)) = self.title_target() else { return; @@ -492,7 +493,15 @@ impl Player { self.seek(at, cx); } None => { - self.notify_user(if forward { "No later key on this title" } else { "No earlier key on this title" }.into()); + // A key past the end sits after every frame of the title, so it can only be ahead + // of the playhead going forward. + let past_end_ahead = forward && t.keys.iter().any(|k| k.at >= t.frames && t.start + k.at > now); + let message = match (forward, past_end_ahead) { + (true, true) => "The next key is past the title's end", + (true, false) => "No later key on this title", + (false, _) => "No earlier key on this title", + }; + self.notify_user(message.into()); cx.notify(); } } diff --git a/crates/app/src/ui/cards/curve.rs b/crates/app/src/ui/cards/curve.rs index ee58708..a41a0d0 100644 --- a/crates/app/src/ui/cards/curve.rs +++ b/crates/app/src/ui/cards/curve.rs @@ -166,6 +166,20 @@ impl Player { } } + /// Why the ease row of `target` is disabled while there is no key on the playhead. A title + /// asks for the playhead to move into it when it lies outside the title, where no key can be. + pub(crate) fn ease_reason(&self, target: CurveTarget) -> &'static str { + let outside = match target { + CurveTarget::Title(idx) => self + .session + .as_ref() + .and_then(|s| s.titles().get(idx)) + .is_some_and(|t| self.title_key_frame(t).is_none()), + CurveTarget::Key(_) | CurveTarget::Effect(_) => false, + }; + if outside { "Move the playhead into the title" } else { "Add a key first" } + } + /// The box of the editor for `target`, made on first use and recorded at prepaint. pub(crate) fn curve_bounds_for(&self, target: CurveTarget) -> Rc>> { self.curve_bounds.borrow_mut().entry(target).or_default().clone() diff --git a/crates/app/src/ui/cards/keys.rs b/crates/app/src/ui/cards/keys.rs index 00bf4c0..79b740a 100644 --- a/crates/app/src/ui/cards/keys.rs +++ b/crates/app/src/ui/cards/keys.rs @@ -202,6 +202,7 @@ impl Player { Some(current) => KeyEase::ALL.iter().position(|e| *e == current).unwrap_or(usize::MAX), None => usize::MAX, }; + let reason = self.ease_reason(target); let on_pick = Rc::new(on_pick); let chips = kit::segmented_equal("key-ease", &labels, selected, here.is_some(), None, move |pick, _, app| { // A custom pick keeps the curve the key already has, or starts from CSS `ease`. @@ -227,7 +228,7 @@ impl Player { .top(px(0.)) .left(px(0.)) .size_full() - .tooltip(overlay_tip_hover("Add a key first", "", None)), + .tooltip(overlay_tip_hover(reason, "", None)), ) }); // The curve shows the draft while a handle is held, else the key's own custom ease.