@jimka/typescript-ui / layout / Split
Class: Split
Defined in: src/typescript/lib/layout/Split.ts:25
A layout manager that splits the container into two or more resizable panels separated by draggable gutter elements. The split direction can be 'horizontal' (panels side by side) or 'vertical' (panels stacked).
Extends
Constructors
new Split()
new Split(direction?: String | SplitOptions, options?: SplitOptions): SplitDefined in: src/typescript/lib/layout/Split.ts:31
Parameters
direction?
String | SplitOptions
options?
Returns
Overrides
Methods
attach()
attach(container: Component): thisDefined in: src/typescript/lib/layout/LayoutManager.ts:58
Associates this layout manager with a container component.
Parameters
container
The container component to attach to.
Returns
this
Inherited from
delLayoutConstraints()
delLayoutConstraints(component: Component): undefined | LayoutConstraintsDefined in: src/typescript/lib/layout/LayoutManager.ts:276
Removes and returns the stored layout constraints for a component.
Parameters
component
The component whose constraints should be removed.
Returns
undefined | LayoutConstraints
The removed constraints, or undefined if none were stored.
Inherited from
LayoutManager.delLayoutConstraints
detach()
detach(): thisDefined in: src/typescript/lib/layout/Split.ts:121
Detaches from the container and removes all gutter elements from the DOM.
Returns
this
Overrides
doLayout()
doLayout(): voidDefined in: src/typescript/lib/layout/Split.ts:143
Creates missing gutters, computes panel sizes, and positions all panels and gutters.
Returns
void
Remarks
New SplitGutter instances are appended to the container's DOM element on first layout. Existing gutters are reused on subsequent layouts.
Overrides
getClassName()
getClassName(): stringDefined in: src/typescript/lib/core/BaseObject.ts:44
Returns the runtime class name of this object.
Returns
string
The name of the constructor function as a string.
Inherited from
getContainer()
getContainer(): null | ComponentDefined in: src/typescript/lib/layout/LayoutManager.ts:78
Returns the container component this layout manager is attached to.
Returns
null | Component
The attached container, or null if not attached.
Inherited from
getDirection()
getDirection(): StringDefined in: src/typescript/lib/layout/Split.ts:66
Returns the split direction.
Returns
String
'horizontal' or 'vertical'.
getId()
getId(): stringDefined in: src/typescript/lib/core/BaseObject.ts:24
Returns the unique identifier for this object.
Returns
string
The UUID string assigned at construction time.
Inherited from
getLayoutConstraints()
getLayoutConstraints(component: Component): undefined | LayoutConstraintsDefined in: src/typescript/lib/layout/LayoutManager.ts:291
Returns the stored layout constraints for a component.
Parameters
component
The component to look up.
Returns
undefined | LayoutConstraints
The stored constraints, or undefined if none are set.
Inherited from
LayoutManager.getLayoutConstraints
getMaxSize()
getMaxSize(): null | SizeDefined in: src/typescript/lib/layout/LayoutManager.ts:106
Returns the maximum size this layout can produce.
Returns
null | Size
The maximum size.
Inherited from
getMinSize()
getMinSize(): null | SizeDefined in: src/typescript/lib/layout/LayoutManager.ts:97
Returns the minimum size this layout can produce.
Returns
null | Size
The minimum size.
Inherited from
getPreferredSize()
getPreferredSize(): null | SizeDefined in: src/typescript/lib/layout/LayoutManager.ts:88
Returns the default preferred size. Subclasses may override this method to compute the preferred size dynamically.
Returns
null | Size
The preferred size, or null if not set.
Inherited from
LayoutManager.getPreferredSize
onDrag()
onDrag(
container: Component,
gutter: SplitGutter,
dragAmount: number): voidDefined in: src/typescript/lib/layout/Split.ts:91
Adjusts the sizes of the two panels adjacent to a gutter when it is dragged.
Parameters
container
The container component that owns the panels.
gutter
The gutter being dragged.
dragAmount
number
The number of pixels the gutter was moved (negative moves left/up).
Returns
void
Remarks
The stored sizes for both affected panels are updated so the next doLayout call preserves the user-defined split ratio.
placeComponent()
placeComponent(
component: Component,
x: number,
y: number,
maxWidth: number,
maxHeight: number,
fill?: null | FillType,
anchor?: null | AnchorType): voidDefined in: src/typescript/lib/layout/LayoutManager.ts:126
Positions and sizes a child component within the given bounds, respecting fill and anchor constraints.
Parameters
component
The child component to position.
x
number
Left edge of the cell in the container's coordinate space.
y
number
Top edge of the cell in the container's coordinate space.
maxWidth
number
Available width for the component.
maxHeight
number
Available height for the component.
fill?
Optional. Fill strategy overriding the component's own constraints.
null | FillType
anchor?
Optional. Anchor point overriding the component's own constraints.
null | AnchorType
Returns
void
Remarks
The method checks the component's stored LayoutConstraints first; the fill and anchor parameters serve as fallbacks. After positioning, doLayout is called on the child so nested layouts are updated in a single pass.
Inherited from
recalculateSizes()
recalculateSizes(): voidDefined in: src/typescript/lib/layout/Split.ts:236
Assigns initial sizes to any components that do not yet have a stored size.
Returns
void
Remarks
When some panels already have stored sizes and a new panel is added, its size is taken proportionally from the existing panels so the total remains constant. When no panels have stored sizes the available container dimension is divided equally.
setDirection()
setDirection(direction: String): thisDefined in: src/typescript/lib/layout/Split.ts:75
Sets the split direction.
Parameters
direction
String
'horizontal' for side-by-side panels, 'vertical' for stacked panels.
Returns
this
setId()
setId(id: string): thisDefined in: src/typescript/lib/core/BaseObject.ts:33
Sets the unique identifier for this object.
Parameters
id
string
The new identifier string to assign.
Returns
this
Inherited from
setLayoutConstraints()
setLayoutConstraints(component: Component, constraints?: LayoutConstraints): undefined | LayoutConstraintsDefined in: src/typescript/lib/layout/LayoutManager.ts:260
Stores layout constraints for a component, or removes them if constraints is undefined.
Parameters
component
The component whose constraints are being set.
constraints?
Optional. The constraints to store; omit to delete existing constraints.
Returns
undefined | LayoutConstraints
The stored constraints, or undefined if they were deleted.