Skip to main content

Crate term_wm_layout_engine

Crate term_wm_layout_engine 

Source
Expand description

Pure-math window layout engine for term-wm.

Provides tiling (BSP/N-ary tree) and floating window layout math with zero runtime dependencies. Supports no_std via the std feature (enabled by default).

Structs§

DragHandle
A hit-test region for the title bar of a floating window.
EdgeResistance
FocusRing
A cyclic focus ring with a single current item.
HeaderDrag
State of an in-progress header drag (move).
LayoutRect
A rectangle with signed origin and unsigned dimensions.
LongestSide
Splits along the longer side of the area (width ≥ height → Horizontal).
Ratio
An integer ratio (p, q) meaning p/(p+q) of the parent’s size.
RegionMap
A map from ID to rectangle, with hit-testing support.
ResizeDrag
State of an in-progress resize drag.
ResizeHandle
A single-cell hit-test handle at a corner or along an edge of a floating window.
ScrollState
Scroll state for a scrollable viewport.
SizeConstraints
Minimum dimensions enforced by tree mutation functions.
SnapPreview
Spiral
Cycles Horizontal, Vertical, Horizontal, Vertical, … based on depth.
ZOrder
A flat z-order list. The last element is the top-most (front-most) item.

Enums§

BspNode
A strict binary (BSP) split tree.
InsertPosition
LayoutError
Errors returned by tree mutation operations.
NaryNode
Orientation
The direction children are stacked in a split container.
Quadrant
One of the four cardinal directions, used for drag-and-drop insertion.
RectSpec
A rectangle specification that can be either absolute or percentage-based.
ResizeEdge
Identifies which edge(s) of a floating window are being dragged.
SnapTarget

Constants§

FLOATING_MIN_HEIGHT
Minimum height for a floating window (in cells).
FLOATING_MIN_WIDTH
Minimum width for a floating window (in cells).

Traits§

LayoutEngine
Common interface for tree-based layout engines (BSP and N-ary).
OrientationHeuristic
Decides which orientation to use when splitting an area.

Functions§

apply_resize_drag_signed
Apply a resize drag delta to a floating window’s geometry.
build_rects_from_sizes
Build rects from a list of per-child sizes along an orientation.
detect_edge_snap
detect_quadrant
Determine which cardinal quadrant of target the cursor falls in.
edge_preview_rect
floating_header_for_region
Generate a drag handle for the title bar of a floating window.
gap_insert
Offset a rectangle by gap * index along the given orientation. Used when placing children in a split with inter-child gaps.
gap_size
Compute the per-gap size between children in a split.
handle_thickness
Compute the visual thickness of a split handle gap.
hit_test_leaf
Find the top-most (last-in-slice) region that contains (col, row).
inset
Shrink a rectangle by the given margins on each side. The resulting width/height saturate at zero.
rect_contains
Convenience wrapper around LayoutRect::contains.
resize_handles_for_region
Generate all 8 resize handles (4 corners + 4 edges) for a floating region.
split_rect_bsp
Split a rectangle into two along the given orientation using a ratio.
split_rects_nary
split_rects_weighted
Weighted split of a rect into child_count rects using integer weights.
split_rects_with_gaps
Split a rect into child_count rects separated by gap-width gaps.
split_sizes
Extract the per-child dimension sizes from a split result.
tiled_preview_rect