Skip to content

LayoutStrategy

Defined in: LayoutManager/LayoutStrategies/LayoutStrategy.ts:21

Exposes a main public method calcLayoutResult that is used by the LayoutManager to perform layout. Returning undefined signals the LayoutManager to skip the layout.

In charge of calculating the bounding box of the passed objects.

new LayoutStrategy(): LayoutStrategy

LayoutStrategy

static type: string = 'strategy'

Defined in: LayoutManager/LayoutStrategies/LayoutStrategy.ts:25

override by subclass for persistence (TS does not support static abstract)

calcBoundingBox(objects, context): LayoutStrategyResult | undefined

Defined in: LayoutManager/LayoutStrategies/LayoutStrategy.ts:68

Override this method to customize layout.

FabricObject<Partial<FabricObjectProps>, SerializedObjectProps, ObjectEvents>[]

StrictLayoutContext

LayoutStrategyResult | undefined


calcLayoutResult(context, objects): LayoutStrategyResult | undefined

Defined in: LayoutManager/LayoutStrategies/LayoutStrategy.ts:33

Used by the LayoutManager to perform layout @TODO/fix: if this method is calcResult, should calc unconditionally. the condition to not calc should be evaluated by the layoutManager.

StrictLayoutContext

FabricObject<Partial<FabricObjectProps>, SerializedObjectProps, ObjectEvents>[]

LayoutStrategyResult | undefined

layout result OR undefined to skip layout


getInitialSize(context, result): Point

Defined in: LayoutManager/LayoutStrategies/LayoutStrategy.ts:58

StrictLayoutContext & CommonLayoutContext & object

Pick<LayoutStrategyResult, "center" | "size">

Point


shouldLayoutClipPath(__namedParameters): boolean | undefined

Defined in: LayoutManager/LayoutStrategies/LayoutStrategy.ts:50

StrictLayoutContext

boolean | undefined


shouldPerformLayout(__namedParameters): boolean

Defined in: LayoutManager/LayoutStrategies/LayoutStrategy.ts:42

StrictLayoutContext

boolean