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§
- Panel
Limits - 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_panelstakes (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 byRESIZE_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
countpanels 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. Aminabove 100 / count is lowered to it. - panel_
extents - Panel lengths in px on the main axis: the container minus every handle
(
handle_extenteach,$control.hairline), shared by the sizes. - resize_
panels - Move handle
handle(between panelshandleandhandle + 1) bydeltapercentage 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.