forge
Explore
Log in

Don't you dare go Hollow

Transition duration row in the darkroom clip tab

Browse files at this commit

93dd61dcbbffd1234fa563268971d645ebcc2038Ahmet Kaan GümüşParent: 7b56f0a
  • feat
    • transition duration row in the darkroom clip tab
Show full message
✨ feat(ui): transition duration row in the darkroom clip tab

The darkroom is the default surface (legacy inspector only reachable
via OLD_GUI=1), but its CLIP tab only ever showed verb ghosts -- a
dissolve/crossfade applied via ctrl+x/ctrl+f had no row to see or
edit its duration on the shipped surface. Adds that row, reusing
ui::inspector::transition_of for the pick and Player::nudge_transition
for the clamped step; only the paint is the darkroom's own idiom.
crates/app/src/ui/dock_stance.rsmodified+55 -0
@@ -1084,6 +1084,60 @@ fn sources_tab(
10841084 /// these onto. Drag-while-playing and every other gesture on a row is
10851085 /// whatever that card already does; nothing about the gesture is reimplemented
10861086 /// here.
1087+/// The transition duration row, in the darkroom's own idiom: the darkroom is
1088+/// the default surface (`main.rs`'s `OLD_GUI` gate), so a row that only ever
1089+/// drew in the legacy inspector (`ui::inspector::transition_duration_row`)
1090+/// was a control a shipped user could never reach after a dissolve
1091+/// (ctrl+x) or crossfade (ctrl+f). Same facts as that row --
1092+/// [`ui::inspector::transition_of`] picks the anchor's transition and its cap,
1093+/// [`Player::nudge_transition`] does the clamped step -- only the paint is
1094+/// this tab's own (`ghost_verb`'s row height and ink tokens, not legacy grey).
1095+fn transition_row(player: &Player, cx: &mut Context<Player>) -> Option<impl IntoElement> {
1096+ let (lane, idx) = player.selected.anchor()?;
1097+ let session = player.session.as_ref()?;
1098+ let clips = session.lane_clips(lane);
1099+ let (label_text, frames, cap) =
1100+ crate::ui::inspector::transition_of(lane.kind, clips.get(idx)?, clips.get(idx + 1))?;
1101+ let label_style = label(type_scale::LABEL_ROW_PX, FontWeight::MEDIUM);
1102+ let step = |id: &'static str, glyph: &'static str, by: i32, cx: &mut Context<Player>| {
1103+ div()
1104+ .id(id)
1105+ .flex()
1106+ .w(px(HIT_MIN))
1107+ .h(px(HIT_MIN))
1108+ .items_center()
1109+ .justify_center()
1110+ .rounded(px(3.))
1111+ .bg(rgb(DARK_RAISED()))
1112+ .cursor_pointer()
1113+ .hover(|s| s.text_color(rgb(INK1())))
1114+ .children(hitmap::control(id, id, true))
1115+ .on_click(cx.listener(move |this, _: &ClickEvent, _, cx| {
1116+ this.nudge_transition(lane, idx, by, cx);
1117+ }))
1118+ .child(glyph)
1119+ };
1120+ Some(
1121+ div()
1122+ .flex_none()
1123+ .flex()
1124+ .items_center()
1125+ .gap(px(6.))
1126+ .h(px(CONTROL_H))
1127+ .px(px(8.))
1128+ .child(
1129+ div()
1130+ .flex_1()
1131+ .font(label_style.font)
1132+ .text_size(label_style.size)
1133+ .text_color(rgb(INK2()))
1134+ .child(format!("{label_text} {frames}f (of {cap}f offered)")),
1135+ )
1136+ .child(step("transition-minus", "−", -1, cx))
1137+ .child(step("transition-plus", "+", 1, cx)),
1138+ )
1139+}
1140+
10871141 fn clip_tab(
10881142 player: &Player,
10891143 width: f32,
@@ -1210,6 +1264,7 @@ fn clip_tab(
12101264 cx.listener(|this, _: &ClickEvent, _, cx| this.cycle_fit(cx)),
12111265 )),
12121266 )
1267+ .children(transition_row(player, cx))
12131268 .child(
12141269 div()
12151270 .id("dock-clip-rows")