Skip to content

FlowConstraint

Overview

Main flow-layout logic. Usually used indirectly through FlowBox, but can also be used directly (say, if nodes don't have the same parent, or a FlowBox can't be used).

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

Class FlowConstraint

import { FlowConstraint } from 'scenerystack/scenery';

Constructor

new FlowConstraint( ancestorNode : Node, providedOptions? : FlowConstraintOptions )

Instance Methods

layout()

(protected)

insertCell( index : number, cell : FlowCell )

removeCell( cell : FlowCell )

reorderCells( cells : FlowCell[], minChangeIndex : number, maxChangeIndex : number )

dispose()

Releases references

Static Methods

create( ancestorNode : Node, options? : FlowConstraintOptions ) : FlowConstraint

Type FlowConstraintOptions

import type { FlowConstraintOptions } from 'scenerystack/scenery';
  • spacing?: number
    The default spacing in-between elements in the primary direction. If additional (or less) spacing is desired for certain elements, per-element margins (even negative) can be set in the layoutOptions of nodes contained.
  • lineSpacing?: number
    The default spacing in-between lines long the secondary axis.
  • justify?: HorizontalLayoutJustification | VerticalLayoutJustification
    How extra space along the primary axis is allocated. The default is spaceBetween.
  • justifyLines?: HorizontalLayoutJustification | VerticalLayoutJustification | null
    How extra space along the secondary axis is allocated. The default is null (which will expand content to fit)
  • wrap?: boolean
    Whether line-wrapping is enabled. If so, the primary preferred axis will determine where things are wrapped.
  • preferredWidthProperty?: TProperty<number | null>
    The preferred width/height (ideally from a container's localPreferredWidth/localPreferredHeight.
  • preferredHeightProperty?: TProperty<number | null>
  • minimumWidthProperty?: TProperty<number | null>
    The minimum width/height (ideally from a container's localMinimumWidth/localMinimumHeight.
  • minimumHeightProperty?: TProperty<number | null>
  • & ExternalFlowConfigurableOptions & NodeLayoutAvailableConstraintOptions

Source Code

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