Skip to content

@fabwcie/free-drawing / utils/order

utils/order ​

Functions ​

applyOrder() ​

applyOrder(nodes, ids): void

Defined in: packages/free-drawing/src/utils/order.ts:59

Put shapes of given ids in this stacking order (order of another client), other shapes keep their place

Parameters

nodes

Node<NodeConfig>[]

Shapes of a layer

ids

string[]

Ids of shapes, from bottom to top

Returns

void


inDrawingOrder() ​

inDrawingOrder<T>(nodes): T[]

Defined in: packages/free-drawing/src/utils/order.ts:83

Nodes in the order they are drawn, bottom first: a shape of a group or of a frame at the place of its parent (konva getAbsoluteZIndex counts depth by depth)

Type Parameters

T

T extends Node<NodeConfig>

Parameters

nodes

T[]

Nodes of a layer, at any depth

Returns

T[]

The nodes sorted, in a new array


reorderShapes() ​

reorderShapes(shapes, order): boolean

Defined in: packages/free-drawing/src/utils/order.ts:14

Move shapes in stacking order of their layer, relative order of moved shapes is kept. forward / backward: above / below the next shape they overlap (moving past other shapes changes nothing), front / back: above / below all shapes

Parameters

shapes

Node<NodeConfig>[]

top nodes to move (selection), children of the same parent; shapes without parent ignored

order

ShapeOrder

where to move them

Returns

boolean

true if a shape moved