Skip to content

@fabwcie/free-drawing / utils/replay

utils/replay ​

Functions ​

creationTime() ​

creationTime(id): number | null

Defined in: packages/free-drawing/src/utils/replay.ts:20

Time a shape was created, read from its id: ids of the library are the time then random characters in base 36 (createId)

Parameters

id

string

Id of a shape

Returns

number | null

Time (ms), null for other ids (files of other apps, previous versions)


inCreationOrder() ​

inCreationOrder<T>(shapes): T[]

Defined in: packages/free-drawing/src/utils/replay.ts:33

Shapes in the order they were created (ids of the library), from bottom to top for the others: a shape without time comes after the shape below it; a group at the time of its first shape (grouped later), a frame at its own time

Type Parameters

T

T extends Node<NodeConfig>

Parameters

shapes

T[]

Shapes of the drawing and of its frames, from bottom to top

Returns

T[]

The shapes, the first created first


outlineLength() ​

outlineLength(shape): number

Defined in: packages/free-drawing/src/utils/replay.ts:51

Length of the outline of a shape, drawn by a moving dash during the replay

Parameters

shape

DrawingShape

Rectangle, ellipse, path, line or arrow

Returns

number

Length in coordinates of the shape, 0 for other shapes


partialStroke() ​

partialStroke(points, progress): number[]

Defined in: packages/free-drawing/src/utils/replay.ts:80

Freehand stroke drawn up to a progress: its outline (perfect-freehand: one side from start to end, then the other one back) cut at the same place on both sides

Parameters

points

number[]

Points of the whole outline (konva coordinates)

progress

number

From 0 (start of the stroke) to 1 (whole stroke)

Returns

number[]

Points of the outline drawn so far