Skip to content

LayoutStrategy

Defined in: src/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.

Extended by

Constructors

new LayoutStrategy()

new LayoutStrategy(): LayoutStrategy

Returns

LayoutStrategy

Properties

type

static type: string = 'strategy'

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

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

Methods

calcBoundingBox()

calcBoundingBox(objects, context): undefined | LayoutStrategyResult

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

Override this method to customize layout.

Parameters

objects

FabricObject[]

context

StrictLayoutContext

Returns

undefined | LayoutStrategyResult


calcLayoutResult()

calcLayoutResult(context, objects): undefined | LayoutStrategyResult

Defined in: src/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.

Parameters

context

StrictLayoutContext

objects

FabricObject[]

Returns

undefined | LayoutStrategyResult

layout result OR undefined to skip layout


getInitialSize()

getInitialSize(context, result): Point

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

Parameters

context

StrictLayoutContext & CommonLayoutContext & object

result

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

Returns

Point


shouldLayoutClipPath()

shouldLayoutClipPath(__namedParameters): undefined | boolean

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

Parameters

__namedParameters

StrictLayoutContext

Returns

undefined | boolean


shouldPerformLayout()

shouldPerformLayout(__namedParameters): boolean

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

Parameters

__namedParameters

StrictLayoutContext

Returns

boolean