Skip to main content

Module resizable

Module resizable 

Source
Expand description

Round 2 (docs/round-2-contract.md §1, Resizable): the panel arithmetic every renderer shares, so a drag or a key press gives the same sizes everywhere. Sizes are PERCENTAGES of the group’s main axis minus its handles (they sum to 100); only the two panels beside the moved handle change. Results are rounded to 1e-6. Mirrors src/resizable.ts; fixtures/resizable.json locks it.

Re-exports§

pub use crate::layout::PANEL_MIN;
pub use crate::layout::RESIZE_HANDLE_HIT;
pub use crate::layout::RESIZE_STEP;

Structs§

PanelLimits
One panel’s limits (Resizable.panels[i]), percent.

Enums§

Orientation
The panel group’s axis.

Constants§

RESIZE_KEYS
The keys a focused handle handles (keyboard_resize); hosts may forward every key, the rest are ignored.

Functions§

drag_delta
A pointer movement (px on the main axis, screen direction) as the percentage delta resize_panels takes (rtl horizontal groups flip).
keyboard_resize
A key on a focused handle (ArrowLeft|ArrowRight|ArrowUp|ArrowDown|Home| End|Enter). Arrows move the HANDLE on screen by RESIZE_STEP (horizontal: Left/Right, rtl flips; vertical: Up/Down); Home / End take the first panel to its min / max; Enter collapses the first panel when collapsible (else the second), reopening a collapsed one at its min. Other keys change nothing.
normalize_sizes
The sizes a group of count panels starts with: the valid given sizes (finite, ≥ 0), the missing ones sharing what is left of 100 (equal split when none is given), scaled to sum 100, each clamped into its [min, max] (a collapsible panel may stay 0) with the difference handed to the panels with room, in order. A min above 100 / count is lowered to it.
panel_extents
Panel lengths in px on the main axis: the container minus every handle (handle_extent each, $control.hairline), shared by the sizes.
resize_panels
Move handle handle (between panels handle and handle + 1) by delta percentage points (positive = the first panel grows), from the sizes at the START of the drag. Clamped so both panels keep their limits; a collapsible panel dragged below half its min collapses to 0, a collapsed one dragged past half its min reopens at max(min, the pointer), clamped the same way. Other panels never change.