Skip to content

@ue-too/board / WorkerRelayCanvas

Class: WorkerRelayCanvas

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:507

Description

A proxy for the canvas that is used to communicate with the web worker. The primary purpose of this class is to cache the canvas dimensions and position in the DOM to reduce the calling of the getBoundingClientRect method. This class only serves as a relay of the updated canvas dimensions and position to the web worker.

Implements

Constructors

Constructor

new WorkerRelayCanvas(canvas, webWorker, canvasDiemsionPublisher): WorkerRelayCanvas

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:515

Parameters

canvas

HTMLCanvasElement

webWorker

Worker

canvasDiemsionPublisher

CanvasPositionDimensionPublisher

Returns

WorkerRelayCanvas

Accessors

detached

Get Signature

get detached(): boolean

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:574

Whether the canvas is currently detached from the DOM

Returns

boolean

Whether the canvas is currently detached from the DOM

Implementation of

Canvas.detached


dimensions

Get Signature

get dimensions(): object

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:566

Combined dimensions and position information

Returns

object

height

height: number

position

position: Point

width

width: number

Combined dimensions and position information

Implementation of

Canvas.dimensions


height

Get Signature

get height(): number

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:554

The canvas height in CSS pixels

Returns

number

The canvas height in CSS pixels

Implementation of

Canvas.height


position

Get Signature

get position(): Point

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:562

The top-left position of the canvas in window coordinates

Returns

Point

The top-left position of the canvas in window coordinates

Implementation of

Canvas.position


width

Get Signature

get width(): number

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:550

The canvas width in CSS pixels

Returns

number

The canvas width in CSS pixels

Implementation of

Canvas.width

Methods

setCursor()

setCursor(style): void

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:578

Sets the CSS cursor style for visual feedback

Parameters

style

"grab" | "default" | "grabbing"

Returns

void

Implementation of

Canvas.setCursor


tearDown()

tearDown(): void

Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:558

Cleanup method to dispose of resources and event listeners

Returns

void

Implementation of

Canvas.tearDown