Lift sidebar resize handle outside the rounded clip so it's hittable
The handle was a child of the rounded sidebar panel, which set overflow_hidden — so the 6 px strip pinned at right(-2) was clipped to the rounded edge and never reached the cursor. Split the panel into an outer positioning wrapper plus an inner rounded panel, and place the handle on the wrapper. Widen the strip to 8 px straddling the edge and warm the hover tint so the affordance is visible during drag.
This commit is contained in:
@@ -19,10 +19,16 @@ impl ElyShell {
|
|||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> AnyElement {
|
) -> AnyElement {
|
||||||
let panel_color = panel_bg(snapshot);
|
let panel_color = panel_bg(snapshot);
|
||||||
|
// Outer wrapper holds the resize handle outside the rounded
|
||||||
|
// panel's overflow_hidden clip; inner panel keeps the rounded
|
||||||
|
// glass treatment without swallowing the column-resize column.
|
||||||
div()
|
div()
|
||||||
.w(px(sidebar_width))
|
.w(px(sidebar_width))
|
||||||
.h_full()
|
.h_full()
|
||||||
.relative()
|
.relative()
|
||||||
|
.child(
|
||||||
|
div()
|
||||||
|
.size_full()
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.rounded(px(spacing::RADIUS_CARD))
|
.rounded(px(spacing::RADIUS_CARD))
|
||||||
@@ -60,7 +66,8 @@ impl ElyShell {
|
|||||||
.children(self.render_sidebar_tab_rows(snapshot, cx))
|
.children(self.render_sidebar_tab_rows(snapshot, cx))
|
||||||
.child(self.render_new_tab_row(cx)),
|
.child(self.render_new_tab_row(cx)),
|
||||||
)
|
)
|
||||||
.child(self.render_sidebar_footer(snapshot, cx))
|
.child(self.render_sidebar_footer(snapshot, cx)),
|
||||||
|
)
|
||||||
.child(render_sidebar_resize_handle(cx))
|
.child(render_sidebar_resize_handle(cx))
|
||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
@@ -457,18 +464,20 @@ const UNREAD_BADGE_BG: u32 = 0x281e140f;
|
|||||||
/// never participates in hit testing.
|
/// never participates in hit testing.
|
||||||
const HIGHLIGHT_BORDER: u32 = 0xffffff80;
|
const HIGHLIGHT_BORDER: u32 = 0xffffff80;
|
||||||
|
|
||||||
/// Sidebar resize affordance pinned to the panel's right edge. The
|
/// Sidebar resize affordance straddling the panel's right edge. The
|
||||||
/// strip itself is invisible until hovered; on mouse-down it tells the
|
/// strip lives in the outer wrapper (not the rounded inner panel) so
|
||||||
/// shell to capture the drag origin so window-level mouse-move can
|
/// it isn't swallowed by `overflow_hidden`; it spans 4 px outside the
|
||||||
/// compute the live width.
|
/// panel and 4 px inside, giving the cursor a comfortably wide hit
|
||||||
|
/// surface that still reads as "edge of the panel" rather than
|
||||||
|
/// "stripe across the layout".
|
||||||
fn render_sidebar_resize_handle(cx: &mut Context<ElyShell>) -> AnyElement {
|
fn render_sidebar_resize_handle(cx: &mut Context<ElyShell>) -> AnyElement {
|
||||||
div()
|
div()
|
||||||
.id(SharedString::from("sidebar-resize-handle"))
|
.id(SharedString::from("sidebar-resize-handle"))
|
||||||
.absolute()
|
.absolute()
|
||||||
.top_0()
|
.top_0()
|
||||||
.bottom_0()
|
.bottom_0()
|
||||||
.right(px(-2.0))
|
.right(px(-4.0))
|
||||||
.w(px(6.0))
|
.w(px(8.0))
|
||||||
.cursor_col_resize()
|
.cursor_col_resize()
|
||||||
.hover(|style| style.bg(rgba(RESIZE_HANDLE_HOVER_BG)))
|
.hover(|style| style.bg(rgba(RESIZE_HANDLE_HOVER_BG)))
|
||||||
.on_mouse_down(
|
.on_mouse_down(
|
||||||
@@ -480,7 +489,7 @@ fn render_sidebar_resize_handle(cx: &mut Context<ElyShell>) -> AnyElement {
|
|||||||
.into_any_element()
|
.into_any_element()
|
||||||
}
|
}
|
||||||
|
|
||||||
const RESIZE_HANDLE_HOVER_BG: u32 = 0xffffff66;
|
const RESIZE_HANDLE_HOVER_BG: u32 = 0xffaa7733;
|
||||||
|
|
||||||
/// Maps appearance translucency_pct to a panel rgba u32 tinted by the
|
/// Maps appearance translucency_pct to a panel rgba u32 tinted by the
|
||||||
/// active wallpaper theme.
|
/// active wallpaper theme.
|
||||||
|
|||||||
Reference in New Issue
Block a user