Skip to content

Interface: IAlignmentStrategy ​

Defined in: src/display/alignment/IAlignmentStrategy.ts:51

Interface for layer alignment strategies

Methods ​

align() ​

ts
align(
   targetSlice, 
   referenceSlice, 
   options?): AlignmentResult;

Defined in: src/display/alignment/IAlignmentStrategy.ts:59

Calculate alignment transformation for a target slice relative to a reference slice

Parameters ​

targetSlice ​

ImageSlice

The slice to align

referenceSlice ​

ImageSlice

The reference slice to align to

options? ​

AlignmentOptions

Alignment options

Returns ​

AlignmentResult

Alignment transformation result


applyAlignment() ​

ts
applyAlignment(sprite, alignment): void;

Defined in: src/display/alignment/IAlignmentStrategy.ts:70

Apply alignment transformation to a sprite

Parameters ​

sprite ​

Sprite

The sprite to transform

alignment ​

AlignmentResult

The alignment result

Returns ​

void


getName() ​

ts
getName(): string;

Defined in: src/display/alignment/IAlignmentStrategy.ts:75

Get the name of this alignment strategy

Returns ​

string


canHandle() ​

ts
canHandle(targetSlice, referenceSlice): boolean;

Defined in: src/display/alignment/IAlignmentStrategy.ts:83

Check if this strategy can handle the given slices

Parameters ​

targetSlice ​

ImageSlice

The slice to align

referenceSlice ​

ImageSlice

The reference slice

Returns ​

boolean

true if this strategy can handle the alignment

Released under the MIT License.