Skip to content

LayoutAlign

Overview

Rich enumeration for internal layout code

NOTE: This is orientation-agnostic for a reason, so that it's natural with GridBox, and FlowBox can switch orientation

@author Jonathan Olson <jonathan.olson@colorado.edu>

Class LayoutAlign

import { LayoutAlign } from 'scenerystack/scenery';

Constructor

new LayoutAlign( horizontal : HorizontalLayoutAlign, vertical : VerticalLayoutAlign, padRatio : number )

Instance Methods

Instance Properties

horizontal : HorizontalLayoutAlign

(readonly)

String enumeration types for the horizontal orientation

vertical : VerticalLayoutAlign

(readonly)

String enumeration types for the vertical orientation

padRatio : number

(readonly)

A multiplier value used in the padding computation

Static Methods

getAllowedAligns( orientation : Orientation ) : readonly ( string | null )[]

getAllowedRestrictedAligns( orientation : Orientation ) : readonly ( string | null )[]

alignToInternal( orientation : Orientation, key : HorizontalLayoutAlign | VerticalLayoutAlign | null ) : LayoutAlign | null

Converts a string union value into the internal Enumeration value

horizontalAlignToInternal( key : HorizontalLayoutAlign | null ) : LayoutAlign | null

verticalAlignToInternal( key : VerticalLayoutAlign | null ) : LayoutAlign | null

internalToAlign( orientation : Orientation, align : LayoutAlign | null ) : HorizontalLayoutAlign | VerticalLayoutAlign | null

Converts an internal Enumeration value into a string union value.

Static Properties

START : LayoutAlign

(readonly)

END : LayoutAlign

(readonly)

CENTER : LayoutAlign

(readonly)

ORIGIN : LayoutAlign

(readonly)

enumeration : Enumeration

(readonly)

Type HorizontalLayoutAlign

import type { HorizontalLayoutAlign } from 'scenerystack/scenery';

"left" | "right" | "center" | "origin"

Type RestrictedHorizontalLayoutAlign

import type { RestrictedHorizontalLayoutAlign } from 'scenerystack/scenery';

"left" | "right" | "center"

Type RestrictedVerticalLayoutAlign

import type { RestrictedVerticalLayoutAlign } from 'scenerystack/scenery';

"top" | "bottom" | "center"

Type VerticalLayoutAlign

import type { VerticalLayoutAlign } from 'scenerystack/scenery';

"top" | "bottom" | "center" | "origin"

Source Code

See the source for LayoutAlign.ts in the scenery repository.