From 270631a14022e4b3d5cfcc240c74b898b9ddcaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Thu, 20 Aug 2026 02:36:20 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(app):=20the=20timeline=20draws?= =?UTF-8?q?=20the=20dissolve=20join=20as=20an=20X,=20ctrl+x=20binds=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The keymap's own rebind test claims ctrl+d as a free chord to demo with, so Dissolve takes ctrl+x instead -- the shape its glyph (widgets.rs, dissolve_glyph) draws at the join. Wired into the clip context menu (menus.rs MENU_ITEMS) and the timeline (ui/timeline.rs): an X over the last transition_out frames of a clip whenever its neighbour still abuts it. --- crates/app/src/keymap.rs | 10 ++++++---- crates/app/src/ui/timeline.rs | 27 +++++++++++++++++++++++++++ crates/app/src/ui/widgets.rs | 28 ++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/crates/app/src/keymap.rs b/crates/app/src/keymap.rs index 152a54f..5020786 100644 --- a/crates/app/src/keymap.rs +++ b/crates/app/src/keymap.rs @@ -972,10 +972,12 @@ impl Keymap { // ctrl its own room now that plain "f" is the mix card's own // (below) -- the same letter, the modifier telling them apart. b(ActionId::Crossfade, "f", true), - // Dissolve takes ctrl+d: the mnemonic letter for "dissolve", - // with ctrl its own room now that plain "d" is Detach's -- - // the same letter, the modifier telling them apart. - b(ActionId::Dissolve, "d", true), + // Dissolve takes ctrl+x: the join it draws on the timeline is + // an X (widgets.rs, dissolve_glyph) -- "d" itself is taken + // both plain (Detach) and, in the keymap's own rebind test, + // as the free chord it rebinds Delete onto, so this reaches + // for the shape instead of the word. + b(ActionId::Dissolve, "x", true), // The mix card takes "f", for the faders on it: "m" would be // the word but it is the monitoring mute, which is this // machine's volume and not the project's -- two things one key diff --git a/crates/app/src/ui/timeline.rs b/crates/app/src/ui/timeline.rs index 6ea34fb..717e90f 100644 --- a/crates/app/src/ui/timeline.rs +++ b/crates/app/src/ui/timeline.rs @@ -1545,6 +1545,33 @@ impl Player { .flatten(), ) }) + // The dissolve: a small X astride the join, drawn + // over the last `transition_out` frames of this + // clip's own box, whenever the next clip on the + // lane actually abuts it -- the engine already + // refuses `transition_out` on anything else + // ([`Project::set_transition_out`]), but a moved + // neighbour can leave a stale value behind, so + // this checks the join itself rather than trust + // the field alone. + .when( + lane.kind == LaneKind::Video + && clip.transition_out > 0 + && clips.get(i + 1).is_some_and(|n| n.start == clip.end()), + |d| { + d.child( + div() + .absolute() + .right_0() + .top_0() + .h_full() + .w(px(scale + .width_px(f64::from(clip.transition_out) / self.fps) + .min(width))) + .child(dissolve_glyph()), + ) + }, + ) // The fade handles: a small grab corner at each // *top* of an audio clip's box, sitting just // inside the [`EDGE_W`] trim strip rather than on diff --git a/crates/app/src/ui/widgets.rs b/crates/app/src/ui/widgets.rs index 4223c48..dd4e0b8 100644 --- a/crates/app/src/ui/widgets.rs +++ b/crates/app/src/ui/widgets.rs @@ -76,6 +76,34 @@ pub(crate) fn fade_wedge(is_in: bool) -> impl IntoElement { .size_full() } +/// A video clip's dissolve into its neighbour, drawn as a small X astride the +/// join -- the box it is given is the last [`Clip::transition_out`] frames of +/// the clip's own width, so the mark sits right at the edge it dissolves +/// through. Two strokes rather than [`fade_wedge`]'s fill: a dissolve is not +/// a ramp to or from silence, it is two clips overlapping, and an X reads as +/// a splice the way a wedge reads as a fade. +pub(crate) fn dissolve_glyph() -> impl IntoElement { + canvas( + |_, _, _| (), + move |bounds, _, window, _| { + let (o, s) = (bounds.origin, bounds.size); + let (w, h) = (f32::from(s.width), f32::from(s.height)); + if w <= 0. || h <= 0. { + return; + } + let mut path = PathBuilder::stroke(px(1.5)); + path.move_to(point(o.x, o.y)); + path.line_to(point(o.x + px(w), o.y + px(h))); + path.move_to(point(o.x + px(w), o.y)); + path.line_to(point(o.x, o.y + px(h))); + if let Ok(path) = path.build() { + window.paint_path(path, rgba(ACCENT_WASH())); + } + }, + ) + .size_full() +} + /// A toolbar button: its glyph, its name, and its key on hover. `id` only buys /// `on_click` and the tooltip -- it is still not focusable, so the root's own /// key listener keeps working after a press, and the click lands on mouse-up