SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

ResizeSession

Headless pointer-resize engine backing the resizeHandle(axis) mixin.

tsx
import { ResizeSession } from "@sdxc/ui/app";

Usage

Owns one resizable panel group's active pointer session. move() re-solves every panel's size from the constraints captured at start(), cascading into further panels so a drag only takes what the group can give up.

Signature

typescript
new ResizeSession()

Properties

PropertyTypeDefaultRequiredDescription
isActiveboolean—YesWhether a pointer session is in progress between start() and end().
activeHandleIndexnumber | null—YesIndex of the handle being dragged in the active session, or null when no session is active.
panelsreadonly ResizeSession.Panel[]—YesEvery panel's current resolved size and constraints, in group order. Returns a defensive copy on every read, so mutating the result never affects the session's own state.

Methods

MethodDescription
start(options: ResizeSession.StartOptions): voidBegins a pointer session on one handle of a panel group, capturing the panels' sizes and constraints as the baseline every subsequent move() in this session solves from.
move(pointerPosition: number): voidRe-solves every panel's size for the current pointer position and dispatches change. A no-op when no session is active, so a mixin can forward every pointermove without guarding on isActive itself.
end(): voidConcludes the active session, keeping the panels at their last solved sizes, and dispatches end. A no-op when no session is active.
cancel(): voidAborts the active session, reverting every panel to the size it had when start() was called, then dispatches change (for the reverted sizes) followed by end. A no-op when no session is active.

The events, constants and types its module publishes, each imported from @sdxc/ui/app too.

Interface

ResizeSession.PanelInput

A panel as supplied to start(): its current size and, optionally, the size constraints the solver must respect. size, min, and max are all expressed as percentages of the panel group's main-axis size (0-100).

MemberTypeDefaultRequiredDescription
idstring—YesStable identifier the consumer uses to map a resolved size back to its panel element.
sizenumber—YesCurrent size, as a percentage of the group's main-axis size.
minnumber—NoSmallest percentage this panel may shrink to. Defaults to 0 when omitted.
maxnumber—NoLargest percentage this panel may grow to. Defaults to 100 when omitted.
Interface

ResizeSession.Panel

A panel's resolved state as read from an in-progress or finished session: min and max are always concrete, defaulted values.

MemberTypeDefaultRequiredDescription
idstring—YesStable identifier, carried over unchanged from the matching PanelInput.
sizenumber—YesCurrent size, as a percentage of the group's main-axis size.
minnumber—YesSmallest percentage this panel may shrink to.
maxnumber—YesLargest percentage this panel may grow to.
Interface

ResizeSession.StartOptions

Snapshot passed to start(): the panel group's layout and constraints at the moment a pointer session begins on one of its handles.

MemberTypeDefaultRequiredDescription
handleIndexnumber—YesIndex of the handle being dragged; it sits between panels[handleIndex] and panels[handleIndex + 1].
panelsreadonly PanelInput[]—YesEvery panel in the group, in visual order along the resize axis.
pointerPositionnumber—YesPointer coordinate along the resize axis (clientX for a horizontal group, clientY for a vertical one) at pointer-down.
groupSizenumber—YesSize, in pixels, of the panel group measured along the resize axis — used to convert pixel pointer deltas into percentage units.
Interface

ResizeSession.Events

Events a ResizeSession dispatches; read the panels getter for the state behind each one.

MemberTypeDefaultRequiredDescription
changeEvent—YesDispatched whenever constraint solving produces new panel sizes, from a pointer move or a cancelled session reverting.
endEvent—YesDispatched once a session concludes, whether by end() or cancel().
@sdxc/ui

Can’t find it? Contact us