pub fn resize_handle<T: 'static, E: 'static + Render>(
id: impl Into<ElementId>,
axis: Axis,
) -> ResizeHandle<T, E>Expand description
Create a resize handle: a band that resizes whatever it edges when it is dragged.
Base owns the band – where it sits, how wide it is, its cursor, and the
Idle → Hovered → Pressed → Dragging progression its appearance is told
about. What a drag resizes is the caller’s. Give the handle a payload with
ResizeHandle::on_drag and follow that payload with
on_drag_move, the way a slider thumb
does; any other listener – a double click that restores a default size, a
hover that a surrounding drawer has to count as its own – goes on the
handle through the interactive element traits.
The band occludes. While the pointer is on it nothing behind it reads as hovered, its own container included, so a container that has to know the pointer is still over it listens on the handle as well.
The band’s element id, its "handle" group, its occlusion and its drag
are base’s: an id, group, hitbox behavior or on_drag set through the
interactive element traits is replaced when the band is laid out.
resize_handle("sidebar-edge", Axis::Horizontal)
.inside(HandleEdge::Trailing)
.on_drag(ResizeSidebar, |drag, _, _, cx| cx.new(|_| drag.clone()))
.on_double_click(|_, _, cx| restore_default_width(cx))