diff --git a/crates/app/src/interact.rs b/crates/app/src/interact.rs index 1b50577..905c022 100644 --- a/crates/app/src/interact.rs +++ b/crates/app/src/interact.rs @@ -247,6 +247,15 @@ pub(crate) fn drag_scrim(cx: &mut Context) -> Div { /// dragging right now ([`Player::split_drag`]), which the pointer leaves on the /// first move -- so the lit line has to come from the model, not from `hover`. /// +/// What the *hand* aims at is wider than what the eye is given: the press and +/// the resize cursor live on a [`GRAB_W`] band centred on the strip, mounted +/// absolutely so it overlays its neighbours instead of pushing them (the strip +/// keeps its [`SPLIT_W`] of layout, and `layout::split_drag_size` keeps +/// answering in strip coordinates). A 6 px target missed by 5 px is a resize +/// the hand cannot find, which is the same as no resize at all (user +/// 2026-09-09: "panes should be enlargable and shrinkable" -- they already +/// were). +/// /// A double press resets the seam to the window's own share /// ([`Splits::clear`]): the cheap way back from a layout dragged somewhere /// unusable, and the one every editor's dividers answer to. @@ -269,23 +278,42 @@ pub(crate) fn divider(split: Split, held: bool, cx: &mut Context) -> Div .when(!held, |d| { d.hover(|s| s.border_color(rgb(STROKE_DIVIDER()))) }) - .on_mouse_down( - MouseButton::Left, - cx.listener(move |this, event: &MouseDownEvent, _, cx| { - match event.click_count >= 2 { - // The reset is written where a release would have written - // the drag, the same small round trip: a seam put back by - // hand must not come back on the next launch. - true => { - this.split_drag = None; - this.splits.clear(split); - crate::layout::save_stance_splits(&this.splits); - } - false => this.split_drag = Some(split), - } - cx.notify(); - cx.stop_propagation(); - }), + .relative() + .child( + div() + .absolute() + .when(across, |d| { + d.left_0() + .right_0() + .top(px((SPLIT_W - GRAB_W) / 2.)) + .h(px(GRAB_W)) + .cursor_row_resize() + }) + .when(!across, |d| { + d.top_0() + .bottom_0() + .left(px((SPLIT_W - GRAB_W) / 2.)) + .w(px(GRAB_W)) + .cursor_col_resize() + }) + .on_mouse_down( + MouseButton::Left, + cx.listener(move |this, event: &MouseDownEvent, _, cx| { + match event.click_count >= 2 { + // The reset is written where a release would have written + // the drag, the same small round trip: a seam put back by + // hand must not come back on the next launch. + true => { + this.split_drag = None; + this.splits.clear(split); + crate::layout::save_stance_splits(&this.splits); + } + false => this.split_drag = Some(split), + } + cx.notify(); + cx.stop_propagation(); + }), + ), ) } diff --git a/crates/app/src/layout.rs b/crates/app/src/layout.rs index 569952b..55f6c9d 100644 --- a/crates/app/src/layout.rs +++ b/crates/app/src/layout.rs @@ -288,6 +288,16 @@ impl Split { /// it looks like. pub(crate) const SPLIT_W: f32 = 6.; +/// How wide the same seam is *aimed at*. The strip above is what the layout +/// spends and the hairline is what the eye is given; this is the band the hand +/// gets, centred on the strip and overlaid on the two panels it parts, so +/// growing it moves nothing. 6 px asked the hand for precision it does not +/// have -- the lead's own press one row into the bench missed the seam by 5 px +/// and focused the bench instead ("panes should be enlargable and shrinkable", +/// of panes that already resized). 12 px is the ±6 px of aim every editor's +/// dividers allow. +pub(crate) const GRAB_W: f32 = 12.; + /// The most of the window one side column may be dragged to. A third each, so /// the picture keeps the middle at every size -- the rule [`library_w`] and /// [`inspector_w`] already lay an untouched window out by, kept once the hand diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index d966771..3bda46b 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -2724,7 +2724,9 @@ fn the_bench_answers_a_wheel_notch_anywhere_over_it() { "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 = 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"); @@ -2791,7 +2793,14 @@ fn the_seam_paints_nothing_until_a_pointer_finds_it() { body.contains("gpui::transparent_black()"), "the divider's line is inked at rest: {body}" ); - for step in [".hover(", "STROKE_DIVIDER()", "INK3()", "border_t_1()", "border_l_1()"] { + for step in [ + ".hover(", + "GRAB_W", + "STROKE_DIVIDER()", + "INK3()", + "border_t_1()", + "border_l_1()", + ] { assert!(body.contains(step), "the divider is missing {step}"); } }