Transition duration row in the darkroom clip tab
Browse files at this commit93dd61dcbbffd1234fa563268971d645ebcc2038Parent: 7b56f0a- feat
- transition duration row in the darkroom clip tab
1 changed file +55 -0
crates/app/src/ui/dock_stance.rsmodified+55 -0
| @@ -1084,6 +1084,60 @@ fn sources_tab( | ||
| 1084 | 1084 | /// these onto. Drag-while-playing and every other gesture on a row is |
| 1085 | 1085 | /// whatever that card already does; nothing about the gesture is reimplemented |
| 1086 | 1086 | /// 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 | + | |
| 1087 | 1141 | fn clip_tab( |
| 1088 | 1142 | player: &Player, |
| 1089 | 1143 | width: f32, |
| @@ -1210,6 +1264,7 @@ fn clip_tab( | ||
| 1210 | 1264 | cx.listener(|this, _: &ClickEvent, _, cx| this.cycle_fit(cx)), |
| 1211 | 1265 | )), |
| 1212 | 1266 | ) |
| 1267 | + .children(transition_row(player, cx)) | |
| 1213 | 1268 | .child( |
| 1214 | 1269 | div() |
| 1215 | 1270 | .id("dock-clip-rows") |