Skip to content

@ue-too/board / index / WorkerRelayCanvas

Class: WorkerRelayCanvas ​

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

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:516

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:575

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:567

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:555

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:563

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:551

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:579

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:559

Cleanup method to dispose of resources and event listeners

Returns ​

void

Implementation of ​

Canvas.tearDown