Skip to main content

Module split_pane

Module split_pane 

Source
Expand description

Split-pane / splitter widget.

A two-pane (horizontal/vertical) container with a draggable divider that live-resizes the panes via set_css_property (the frame two-box layout + the map/slider pointer-drag state machine); see split_pane.rs. Split-pane / splitter widget — a two-pane container (horizontal or vertical) holding two arbitrary child Doms with a draggable divider between them that resizes the panes.

This is crate::widgets::frame::Frame’s “two bordered boxes” composed with the pointer-drag state machine of crate::widgets::map / crate::widgets::slider::Slider: the drag callbacks live on the container (so the cursor stays inside the callback node for the whole drag, exactly like the map’s pan), MouseDown near the divider begins the drag, MouseOver while dragging recomputes the split ratio from the cursor delta and live-resizes the two panes via set_css_property (flex-grow), and MouseUp / MouseLeave ends it.

§Layout model

The container is a flex row (horizontal split: panes left/right) or column (vertical split: panes top/bottom). Its three children are [first-pane, divider, second-pane]. Both panes use flex-basis: 0 and a flex-grow of ratio / 1 - ratio, so they split the container’s main-axis space proportionally while the divider keeps its fixed thickness. Dragging rewrites the two flex-grow values.

§Drag tracking (mirrors map::MapTileCache)

The transient drag fields (is_dragging, drag_start_px, ratio_at_drag_start) live in [SplitPaneStateWrapper] (not the user-visible [SplitPaneState]), the same way the map keeps drag_anchor in its cache. On press we record the cursor’s main-axis position and the ratio at that moment; each move applies ratio_at_drag_start + delta / main_size, so grabbing the divider anywhere keeps it under the cursor (the map’s anchor-delta feel).

TODO2 / PARTIAL — continuous drag is NOT verifiable in this headless build. Like map.rs’s pan, the live resize depends on the runtime delivering MouseOver (with a node-relative cursor) repeatedly while the button is held, and on set_css_property(flex-grow) triggering a relayout per move — both are GUI-runtime behaviours with no headless test here. The DOM, the divider, the proportional flex-grow sizing, and the press/move/release wiring all compile and mirror the proven map/slider pattern exactly; the moment-to-moment motion is the only unverified part. No motion is faked.

Key types: [SplitPane], [SplitPaneState], [SplitDirection], [SplitPaneOnResize].

Structs§

SplitPane
A two-pane resizable container with a draggable divider.
SplitPaneOnResize
SplitPaneOnResizeCallback
SplitPaneState
State of a SplitPane: the orientation and the first pane’s size fraction.
SplitPaneStateWrapper

Enums§

OptionSplitPaneOnResize
SplitDirection
Orientation of a SplitPane.

Statics§

SPLIT_PANE_ON_RESIZE_INVOKER
Process-global slot for this callback kind’s host-side invoker.

Functions§

AzApp_setSplitPaneOnResizeCallbackInvoker
Register the host-side invoker for this callback kind.
AzSplitPaneOnResizeCallback_createFromHostHandle
C-ABI export wrapping <Wrapper>::create_from_host_handle.

Type Aliases§

AzSplitPaneOnResizeCallbackInvoker
Pointer-arg variant of this callback kind’s typedef.
SplitPaneOnResizeCallbackType
Callback function type invoked when the split ratio changes (during a drag).