From 6ca49065d53f4b454d09465fa2fa825b10d2eb24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 9 Sep 2026 17:15:07 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(app):=20the=20bench=20answer?= =?UTF-8?q?s=20a=20wheel=20notch=20anywhere=20over=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The wheel only moved the view when the pointer sat on a track: the only listeners were one per lane bed and one on the ruler strip, so the head column, the gaps between rows, the strip left of the ruler and the space below the last track all swallowed the notch. The row's listener moves up to the whole row and `bench-content` answers everything else, with the row still stopping so no strip answers one notch twice. Mapping unchanged (ctrl zooms about the pointer, bare scrolls the view along). --- crates/app/src/tests/layout.rs | 45 +++++++++++++++++++++++++++++++ crates/app/src/ui/bench_stance.rs | 36 ++++++++++++++----------- 2 files changed, 65 insertions(+), 16 deletions(-) diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index b4b49b3..c0030c1 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -2649,3 +2649,48 @@ fn hitmap_names_every_darkroom_pointer_entry_surface() { } } } + +/// The wheel is the bench's, not a clip's: the user rolled it over the bench +/// and nothing moved unless the pointer happened to sit on a track, because +/// the only listeners were one per bed and one on the ruler strip. The row's +/// listener now sits on the whole row (head column included) and stops there, +/// and `bench-content` answers everything else -- the strip left of the ruler, +/// the ruler itself, the gaps between rows, the space below the last track. +/// Exactly two listeners, so no strip answers one notch twice. +#[test] +fn the_bench_answers_a_wheel_notch_anywhere_over_it() { + let bench = src_text("ui/bench_stance.rs"); + assert_eq!( + bench.matches(".on_scroll_wheel(").count(), + 2, + "the bench has a wheel listener per region again -- a notch would be answered twice" + ); + let row = bench + .find(".id((\"bench-lane\", lane.ord") + .expect("no lane row"); + let bed = bench.find(".id((\"bench-bed\"").expect("no lane bed"); + let row_wheel = bench[row..bed] + .find(".on_scroll_wheel(") + .map(|at| &bench[row + at..bed]) + .expect("the lane row does not answer the wheel -- only its bed does"); + assert!( + row_wheel[..200].contains("cx.stop_propagation();") + && row_wheel[..200].contains("this.timeline_wheel(event, cx)"), + "the row's wheel lost the mapping or its stop: {}", + &row_wheel[..200] + ); + let content = bench.find(".id(\"bench-content\")").expect("no bench content"); + let content_wheel = bench[content..] + .find(".on_scroll_wheel(") + .expect("the bench container does not answer the wheel"); + assert!( + content_wheel < 700 && bench[content..].contains("this.timeline_wheel(event, cx)"), + "the container's wheel listener is not on the container itself" + ); + let ruler = bench.find(".id(\"bench-ruler\")").expect("no ruler"); + let lanes = bench.find(".id(\"bench-lanes\")").expect("no lane column"); + assert!( + !bench[ruler..lanes].contains(".on_scroll_wheel("), + "the ruler answers the wheel on its own again -- one notch, two scrolls" + ); +} diff --git a/crates/app/src/ui/bench_stance.rs b/crates/app/src/ui/bench_stance.rs index f7b31c2..f1bf263 100644 --- a/crates/app/src/ui/bench_stance.rs +++ b/crates/app/src/ui/bench_stance.rs @@ -829,6 +829,17 @@ fn lane_row( .h(px(h)) .flex() .relative() + // The wheel, matched to the legacy timeline's own mapping: ctrl+wheel + // zooms about the pointer, a bare wheel scrolls the bed along the film + // (`Player::timeline_wheel`). On the whole row -- head column and bed + // alike -- not on the bed alone: a hand rolls the wheel wherever it + // left the pointer, and aiming at a clip first is a tax. Stopped here + // so gpui's own overflow scroll on the lane column (`bench-lanes`) and + // `bench-content`'s catch-all below never answer the same notch again. + .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| { + cx.stop_propagation(); + this.timeline_wheel(event, cx); + })) // Dragged, the whole track moves in the stack (`LaneDrag`, // `Player::reorder_lane`) -- let go anywhere along the row, not just // over the head column, since a slot is what is being aimed at. @@ -1148,15 +1159,6 @@ fn lane_row( this.preview_ghost_pick(track, lane, event.event.position.x, cx); }), ) - // The wheel, matched to the legacy timeline's own mapping: - // ctrl+wheel zooms about the pointer, a bare wheel scrolls - // the bed along the film (`Player::timeline_wheel`). Stopped - // here so gpui's own overflow scroll on the lane column - // (`bench-lanes`) never answers the same notch a second time. - .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| { - cx.stop_propagation(); - this.timeline_wheel(event, cx); - })) .children(hitmap::dynamic( move || { ( @@ -1290,6 +1292,15 @@ pub(crate) fn render( .flex() .flex_col() .gap(px(ROW_GAP)) + // The wheel over the WHOLE bench region, not just a bed: the ruler, + // the strip left of it, the gaps between rows and the space below the + // last track all answer a notch here with the same mapping every row + // gives (`Player::timeline_wheel`; the ruler's own former listener + // folded into this one, so no strip answers a notch twice). A row + // stops propagation, so a notch over a track never reaches this. + .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| { + this.timeline_wheel(event, cx); + })) .child( // Pinned ruler: click/drag to seek (reuses `Player::scrub_to`, // the same call the legacy ruler makes), tick marks with mono @@ -1313,13 +1324,6 @@ pub(crate) fn render( this.scrub_to(event.position.x, true, cx); }), ) - // Ctrl+wheel zooms about the pointer, a bare one scrolls the - // bed along -- the same mapping every bed below gives, and - // the legacy ruler's own (`ui/timeline.rs`'s - // `on_scroll_wheel` at its ruler strip). - .on_scroll_wheel(cx.listener(|this, event: &ScrollWheelEvent, _, cx| { - this.timeline_wheel(event, cx); - })) .children(ticks.into_iter().map(|(x, label)| { div().absolute().top_0().left(px(x)).child( div()