FlowConfigurable¶
Overview¶
Mixin for storing options that can affect each cell. null
for values usually means "inherit from the default".
Handles a lot of conversion from internal Enumeration values (for performance) and external string representations. This is done primarily for performance and that style of internal enumeration pattern. If string comparisons are faster, that could be used instead.
NOTE: Internal non-string representations are also orientation-agnostic - thus "left" and "top" map to the same "start" internally, and thus the external value will appear to "switch" depending on the orientation.
NOTE: This is mixed into both the constraint AND the cell, since we have two layers of options. The null
meaning "inherit from the default" is mainly used for the cells, so that if it's not specified in the cell, it will be specified in the constraint (as non-null).
NOTE: This is a mixin meant to be used internally only by Scenery (for the constraint and cell), and should not be used by outside code.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Type ExternalFlowConfigurableOptions¶
We remove the null values for the values that won't actually take null
WithoutNull<FlowConfigurableOptions, Exclude<keyof FlowConfigurableOptions, "minContentWidth" | "minContentHeight" | "maxContentWidth" | "maxContentHeight">>
Type FlowConfigurableOptions¶
- orientation?: LayoutOrientation | null
The main orientation of the layout that takes place. Items will be spaced out in this orientation (e.g. if it's 'vertical', the y-values of the components will be adjusted to space them out); this is known as the "primary" axis. Items will be aligned/stretched in the opposite orientation (e.g. if it's 'vertical', the x-values of the components will be adjusted by align and stretch); this is known as the "secondary" or "opposite" axis. See https://phetsims.github.io/scenery/doc/layout#FlowBox-orientation - align?: HorizontalLayoutAlign | VerticalLayoutAlign | null
Adjusts the position of elements in the "opposite" axis, either to a specific side, the center, or so that all the origins of items are aligned (similar to x=0 for a 'vertical' orientation). See https://phetsims.github.io/scenery/doc/layout#FlowBox-align - cellAlign?: RestrictedVerticalLayoutAlign | RestrictedHorizontalLayoutAlign | null
In the "primary" axis, IF the cell is marked with a grow value, AND the node cannot expand to fill the space, cellAlign will control the positioning of the node within the cell. See https://phetsims.github.io/scenery/doc/layout#FlowBox-cellAlign - stretch?: boolean
Controls whether elements will attempt to expand along the "opposite" axis to take up the full size of the largest layout element. See https://phetsims.github.io/scenery/doc/layout#FlowBox-stretch - grow?: number | null
Controls whether elements will attempt to expand along the "primary" axis. Elements will expand proportionally based on the total grow sum (and will not expand at all if the grow is zero). See https://phetsims.github.io/scenery/doc/layout#FlowBox-grow - & MarginLayoutConfigurableOptions
Source Code¶
See the source for FlowConfigurable.ts in the scenery repository.