Skip to content

@fabwcie/free-drawing / utils/align

utils/align ​

Variables ​

stackGap ​

const stackGap: 16 = 16

Defined in: packages/free-drawing/src/utils/align.ts:7

Space between shapes stacked by stackShapes (drawing units)

Functions ​

alignShapes() ​

alignShapes(nodes, layer, alignment): void

Defined in: packages/free-drawing/src/utils/align.ts:54

Align nodes on a side or the center of their whole box: left sides on the leftmost one, centers on the center of the box...

Parameters

nodes

Node<NodeConfig>[]

shapes to align (2 at least, else nothing done)

layer

Container

draw layer

alignment

ShapeAlignment

side or center of the whole box

Returns

void


distributeShapes() ​

distributeShapes(nodes, layer, direction): void

Defined in: packages/free-drawing/src/utils/align.ts:88

Same space between nodes along an axis: the first and last ones (by their center) stay, the others are placed between them in the order of their centers

Parameters

nodes

Node<NodeConfig>[]

shapes to distribute (3 at least, else nothing done)

layer

Container

draw layer

direction

Direction

horizontal: spaces between left and right sides, vertical: between top and bottom

Returns

void


moveBy() ​

moveBy(node, layer, dx, dy): void

Defined in: packages/free-drawing/src/utils/align.ts:25

Move a node by a distance in layer coordinates, whatever its parent (group turned, flipped or scaled, content of a frame): along the axes of the drawing

Parameters

node

Node

shape, group or frame

layer

Container

draw layer

dx

number

horizontal distance, layer units

dy

number

vertical distance, layer units

Returns

void


stackShapes() ​

stackShapes(nodes, layer, direction, gap?): void

Defined in: packages/free-drawing/src/utils/align.ts:117

Nodes one after the other along an axis, gap between them: the first one (left or top) stays, the others follow it in the order of their starts, their place on the other axis is kept

Parameters

nodes

Node<NodeConfig>[]

shapes to stack (2 at least, else nothing done)

layer

Container

draw layer

direction

Direction

horizontal: a row from left to right, vertical: a column from top to bottom

gap?

number = stackGap

space between two shapes (drawing units)

Returns

void