Skip to content

@fabwcie/free-drawing / components/Replay

components/Replay ​

Classes ​

Replay ​

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:44

Replay of how a drawing was made: its shapes appear again one after the other, in the order they were created (time of their ids), outlines drawn, brush strokes traced, texts typed, other shapes faded in. The drawing is not changed: its layer is hidden (on screen only), copies of its shapes are drawn in the selection layer. Interface hidden but a bar (start again, play / pause, number, speed, stop), the view on the whole drawing; Space plays or pauses, Left / Right show the previous / next shape, Home / End the start / the whole drawing, Escape stops. View, tool and interface come back once it stops

Constructors ​

Constructor ​

new Replay(drawer): Replay

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:83

Create the hidden bar in the floating region; the replay stops once the drawing is loaded again (selection layer emptied)

Parameters
drawer ​

Drawer

Drawer whose drawing is replayed

Returns

Replay

Properties ​

$bar ​

$bar: HTMLDivElement

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:48

Bar of the replay: start again, play / pause, number of the shape, speed, stop

$count ​

$count: HTMLSpanElement

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:54

Number of the shape appearing and of the shapes

$playButton ​

$playButton: HTMLButtonElement

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:52

Button playing or pausing the replay

$restartButton ​

$restartButton: HTMLButtonElement

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:50

Button starting the replay again

$speedButton ​

$speedButton: HTMLButtonElement

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:56

Button changing the speed (1×, 2×, 4×)

$stopButton ​

$stopButton: HTMLButtonElement

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:58

Button stopping the replay

drawer ​

drawer: Drawer

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:46

Drawer whose drawing is replayed

index ​

index: number = -1

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:62

Index of the shape appearing in steps (the ones before it shown whole), its length once finished, -1 stopped

playing ​

playing: boolean = false

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:64

Shapes appear (else paused)

speed ​

speed: number = 1

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:66

Speed (replaySpeeds)

steps ​

steps: ReplayStep[] = []

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:60

Shapes replayed, in the order they were created

Accessors ​

active ​
Get Signature

get active(): boolean

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:116

Replay going on

Returns

boolean

True while the drawing is replayed (also paused or finished)

Methods ​

_activate() ​

private _activate(tool): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:477

Tool activated (pan during the replay, the previous tool after it), none deactivates the active one

Parameters
tool ​

BaseWidget | null

Tool to activate, null for none

Returns

void

_createButton() ​

private _createButton(icon, label, shortcut, action): HTMLButtonElement

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:490

Button of the bar: icon, name with its key

Parameters
icon ​

string

Svg markup

label ​

"drawer.label" | "language.auto" | "toast.collaborationUnavailable" | "toast.collaborationFull" | "toast.collaborationTooBig" | "toast.canDraw" | "toast.viewOnly" | "toast.joinedViewOnly" | "toast.presentationStarted" | "toast.presentationEnded" | "toast.requestSent" | "toast.requestReceived" | "toast.requestRefused" | "toast.saveFailed" | "toast.saved" | "toast.styleCopied" | "toast.libraryImported" | "toast.libraryNotSaved" | "toast.loadFailed" | "toast.invalidFile" | "toast.linkCopied" | "toast.linkNotCopied" | "toast.invalidLink" | "toast.invalidShapeLink" | "toast.clipboardUnavailable" | "toast.exportFailed" | "toast.imageCopied" | "toast.storageCleared" | "toast.imageNotCopied" | "error.clipboardUnavailable" | "error.nothingToExport" | "error.notDrawingFile" | "error.notImage" | "error.damagedLink" | "error.drawingTooBig" | "error.imageNotCreated" | "error.serverUnreachable" | "error.notAllowed" | "error.storageFull" | "error.notLibraryFile" | "error.noDrawingInImage" | "error.insecurePage" | "error.roomKey" | "error.encryptionUnsupported" | "toast.selectionTool" | "modal.close" | "confirm.message" | "confirm.clearCanvas" | "confirm.clearStorage" | "confirm.stopCollaboration" | "confirm.leaveCollaboration" | "confirm.cancel" | "confirm.confirm" | "menu.label" | "menu.open" | "menu.saveAs" | "menu.save" | "menu.unsaved" | "menu.copyLink" | "menu.collaboration" | "menu.collaborationOn" | "menu.collaborationUsers" | "menu.export" | "menu.clearCanvas" | "menu.showGrid" | "menu.zenMode" | "menu.darkMode" | "menu.github" | "menu.githubLabel" | "menu.clearStorage" | "menu.background" | "menu.language" | "menu.commands" | "menu.preferences" | "preferences.title" | "preferences.autoSave" | "preferences.shapeRecognition" | "grid.style" | "grid.squares" | "grid.dots" | "grid.lines" | "grid.isometric" | "grid.styleCommand" | "preferences.wheel" | "wheel.zoom" | "wheel.pan" | "wheel.command" | "help.spaceDrag" | "help.wheelDrag" | "preferences.save" | "preferences.appearance" | "preferences.theme" | "preferences.light" | "preferences.dark" | "preferences.system" | "preferences.drawing" | "commands.search" | "commands.empty" | "commands.file" | "commands.language" | "color.white" | "color.lightGray" | "color.lightBlue" | "color.lightYellow" | "color.lightBeige" | "color.lightRed" | "color.lightGreen" | "color.black" | "color.red" | "color.green" | "color.blue" | "color.orange" | "color.yellow" | "color.pink" | "color.transparent" | "color.custom" | "color.pick" | "help.title" | "help.documentation" | "help.issue" | "help.shortcuts" | "help.tools" | "help.editor" | "help.view" | "help.or" | "help.selectAll" | "help.deleteSelection" | "help.duplicate" | "help.group" | "help.selectInGroup" | "help.constrainDrawing" | "help.whileDrawing" | "help.cancelDrawing" | "help.arrowUnlinked" | "help.constrainSelection" | "help.whileTransforming" | "help.move" | "help.forwardBackward" | "help.frontBack" | "help.lock" | "help.paste" | "help.open" | "help.save" | "help.export" | "help.grid" | "help.layers" | "help.layersSelect" | "help.snap" | "help.zoom" | "help.toolsConstrain" | "key.delete" | "key.arrows" | "key.click" | "key.space" | "key.wheel" | "key.ctrl" | "key.shift" | "key.alt" | "key.escape" | "key.enter" | "key.tab" | "key.home" | "key.end" | "key.backspace" | "toolbar.label" | "toolbar.moreTools" | "toolbar.keepTool" | "tools.pan" | "tools.selection" | "tools.brush" | "tools.eraser" | "tools.text" | "tools.note" | "tools.line" | "tools.square" | "tools.circle" | "tools.arrow" | "tools.image" | "tools.triangle" | "tools.diamond" | "tools.laser" | "tools.frame" | "zoom.label" | "zoom.out" | "zoom.in" | "zoom.reset" | "zoom.fit" | "zoom.selection" | "zoom.to100" | "history.label" | "history.undo" | "history.redo" | "position.label" | "position.recenter" | "context.paste" | "context.snap" | "context.lock" | "context.unlock" | "selectionMenu.label" | "action.duplicate" | "action.copyStyle" | "action.pasteStyle" | "library.title" | "library.add" | "library.empty" | "library.hint" | "library.insert" | "library.remove" | "library.import" | "library.export" | "library.close" | "library.shapes" | "search.label" | "search.count" | "search.none" | "slideshow.start" | "slideshow.presentFrom" | "slideshow.label" | "slideshow.previous" | "slideshow.next" | "slideshow.stop" | "slideshow.count" | "slideshow.slide" | "slideshow.slideTitled" | "slideshow.noFrames" | "slideshow.nextPrevious" | "slideshow.firstLast" | "slideshow.whilePresenting" | "replay.start" | "replay.label" | "replay.play" | "replay.pause" | "replay.restart" | "replay.speed" | "replay.stop" | "replay.count" | "replay.empty" | "replay.finished" | "replay.playPause" | "replay.step" | "replay.firstLast" | "replay.whileReplaying" | "navigation.description" | "navigation.text" | "navigation.shapes" | "navigation.from" | "navigation.to" | "navigation.link" | "navigation.locked" | "navigation.in" | "navigation.index" | "navigation.left" | "navigation.nextPrevious" | "navigation.enter" | "navigation.parent" | "navigation.leave" | "navigation.onDrawing" | "search.previous" | "search.next" | "search.close" | "action.group" | "action.ungroup" | "action.sendToBack" | "action.sendBackward" | "action.bringForward" | "action.bringToFront" | "action.delete" | "action.rotateRight" | "action.rotateLeft" | "action.flipHorizontal" | "action.flipVertical" | "action.insertImage" | "toast.imageFailed" | "action.alignLeft" | "action.alignCenter" | "action.alignRight" | "action.alignTop" | "action.alignMiddle" | "action.alignBottom" | "action.distributeHorizontal" | "action.distributeVertical" | "action.stackHorizontal" | "action.stackVertical" | "action.fitTextWidth" | "action.copyPng" | "action.copySvg" | "action.link" | "overlay.tool" | "overlay.selection" | "overlay.shape" | "overlay.brush" | "overlay.recognizeShapes" | "overlay.recognizeShapesHint" | "overlay.note" | "overlay.text" | "overlay.stroke" | "overlay.color" | "overlay.background" | "overlay.strokeWidth" | "overlay.strokeStyle" | "overlay.edges" | "overlay.arrowType" | "overlay.startHead" | "overlay.endHead" | "overlay.opacity" | "overlay.layers" | "overlay.align" | "overlay.distribute" | "overlay.actions" | "link.address" | "link.placeholder" | "link.open" | "link.remove" | "width.thin" | "width.medium" | "width.thick" | "width.extraThick" | "style.solid" | "style.dashed" | "style.dotted" | "edges.sharp" | "edges.round" | "edges.radius" | "edges.auto" | "arrow.straight" | "arrow.curved" | "arrow.elbow" | "arrowhead.none" | "arrowhead.arrow" | "arrowhead.triangle" | "arrowhead.dot" | "arrowhead.bar" | "text.fontFamily" | "text.fontSize" | "text.small" | "text.medium" | "text.large" | "text.extraLarge" | "text.style" | "text.bold" | "text.italic" | "text.underline" | "text.strikethrough" | "text.align" | "text.alignLeft" | "text.alignCenter" | "text.alignRight" | "layers.title" | "layers.group" | "layers.close" | "layers.empty" | "layers.drag" | "layers.shapesOf" | "layers.hide" | "layers.lock" | "layers.delete" | "layers.name" | "layers.toggle" | "layers.range" | "shapes.freehand" | "shapes.line" | "shapes.rect" | "shapes.ellipse" | "shapes.arrow" | "shapes.triangle" | "shapes.diamond" | "shapes.heart" | "shapes.cloud" | "shapes.star" | "shapes.hexagon" | "shapes.blockArrow" | "shapes.bubble" | "shapes.checkbox" | "shapes.shape" | "shapes.highlighter" | "shapes.frame" | "shapes.frameName" | "shapes.text" | "shapes.note" | "shapes.group" | "shapes.image" | "export.title" | "export.empty" | "export.options" | "export.selected" | "export.background" | "export.dark" | "export.withDrawing" | "export.scale" | "export.saveAs" | "export.saveFile" | "export.copy" | "export.preview" | "collab.title" | "collab.intro" | "collab.introInvited" | "collab.introJoined" | "collab.introJoinedOf" | "collab.name" | "collab.anonymous" | "collab.link" | "collab.copy" | "collab.qrCode" | "collab.start" | "collab.join" | "collab.stop" | "collab.leave" | "collab.live" | "collab.liveState" | "collab.connected" | "collab.connecting" | "collab.you" | "collab.invitedBy" | "collab.canDrawLabel" | "collab.canDraw" | "collab.newUsersCanDraw" | "collab.encrypted" | "collab.notEncrypted" | "collab.owner" | "collab.viewOnly" | "collab.present" | "collab.presenting" | "collab.follow" | "collab.followPresentation" | "collab.following" | "collab.youCanDraw" | "collab.youViewOnly" | "collab.requestEdit" | "collab.requestSent" | "collab.requests" | "collab.requestsCount" | "collab.accept" | "collab.refuse" | "collab.acceptLabel" | "collab.refuseLabel" | "collab.users" | "collab.settings"

Key of its name

shortcut ​

string

Key doing the same, shown in its tooltip

action ​

() => void

Run on click

Returns

HTMLButtonElement

Button

_createStep() ​

private _createStep(shape, copy): ReplayStep

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:375

Appearance of a shape: text typed, brush stroke traced, outline drawn (then its fill), other shapes faded in; frames: their box and title only

Parameters
shape ​

DrawingShape

Shape of the drawing

copy ​

DrawingShape

Its copy shown by the replay

Returns

ReplayStep

Step of the replay

_createSteps() ​

private _createSteps(shapes): ReplayStep[]

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:328

Copies of the shapes and their appearance: shapes of frames in the copy of their frame (cut by it), shown at their own time

Parameters
shapes ​

DrawingShape[]

Shapes of the drawing and of its frames, in the order they were created

Returns

ReplayStep[]

Steps of the replay, every copy hidden

_tick() ​

private _tick(now): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:313

Animation frame: time passed since the previous one

Parameters
now ​

number

Time of the frame

Returns

void

_updateBar() ​

private _updateBar(): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:459

Number of the shape appearing in the bar, play button as playing or paused, speed

Returns

void

advance() ​

advance(time): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:205

Time passes: the shape appearing goes on, the next ones after it (each one, then a short pause)

Parameters
time ​

number

Time passed (ms), multiplied by the speed

Returns

void

goTo() ​

goTo(index, play?): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:238

Shapes before a step shown whole, the others hidden: replay from there

Parameters
index ​

number

Index of the shape appearing next (length of steps: whole drawing)

play? ​

boolean = false

Play from there

Returns

void

handleKey() ​

handleKey(e): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:280

Keys of the drawer during the replay (see HotKey): play / pause, previous / next shape, start, end, stop. Other keys do nothing in the drawer, shortcuts of the browser (Ctrl / Cmd) are kept

Parameters
e ​

KeyboardEvent

Key pressed in the drawer

Returns

void

pause() ​

pause(): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:178

Shapes stop appearing, the shape appearing stays as it is

Returns

void

play() ​

play(): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:165

Shapes appear again, from the start once finished

Returns

void

setSpeed() ​

setSpeed(speed): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:196

Speed of the replay

Parameters
speed ​

number

1, 2 or 4 (replaySpeeds)

Returns

void

start() ​

start(): boolean

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:124

Start the replay from the first shape created, the view on the whole drawing. Without shape, told in a toast

Returns

boolean

True when it started, false without shape

stop() ​

stop(): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:253

Stop the replay: drawing, interface, tool and view of the drawer given back

Returns

void

toggle() ​

toggle(): void

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:187

Play when paused (or finished), pause when playing

Returns

void

Variables ​

replayName ​

const replayName: "drawer-replay" = 'drawer-replay'

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:25

Name of the group of the copies of the shapes replayed, in the selection layer


replaySpeeds ​

const replaySpeeds: number[]

Defined in: packages/free-drawing/src/components/Replay/Replay.ts:28

Speeds of the replay, in turn