Skip to content

@ue-too/board / index / SvgProxy

Class: SvgProxy ​

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

Abstraction interface for canvas element access and manipulation.

Remarks ​

This interface provides a decoupled way to access canvas properties without direct DOM access. Multiple implementations exist to support different use cases:

  • CanvasProxy: Full implementation for HTML canvas elements with dimension tracking
  • SvgProxy: Implementation for SVG elements
  • DummyCanvas: No-op implementation for web worker contexts
  • WorkerRelayCanvas: Relays canvas dimension updates to web workers
  • CanvasCacheInWebWorker: Caches canvas dimensions within a web worker

The abstraction enables:

  • Coordinate system transformations (window → canvas → viewport)
  • Canvas dimension tracking without repeated DOM queries
  • Cursor style management
  • Support for both canvas and SVG rendering contexts

Implements ​

Constructors ​

Constructor ​

new SvgProxy(svg?): SvgProxy

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

Parameters ​

svg? ​

SVGSVGElement

Returns ​

SvgProxy

Accessors ​

detached ​

Get Signature ​

get detached(): boolean

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

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

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

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

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

The canvas width in CSS pixels

Returns ​

number

The canvas width in CSS pixels

Implementation of ​

Canvas.width

Methods ​

attach() ​

attach(svg): void

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

Parameters ​

svg ​

SVGSVGElement

Returns ​

void


notify() ​

notify(...data): void

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

Parameters ​

data ​

...[CanvasDimensions]

Returns ​

void

Implementation of ​

Observable.notify


setCursor() ​

setCursor(style): void

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

Sets the CSS cursor style for visual feedback

Parameters ​

style ​

"grab" | "default" | "grabbing"

Returns ​

void

Implementation of ​

Canvas.setCursor


setHeight() ​

setHeight(height): void

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

set the height of the canvas the height is synonymous with the canvas style height not the canvas height

Parameters ​

height ​

number

Returns ​

void


setWidth() ​

setWidth(width): void

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

set the width of the canvas the width is synonymous with the canvas style width not the canvas width

Parameters ​

width ​

number

Returns ​

void


subscribe() ​

subscribe(observer, options?): () => void

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

Parameters ​

observer ​

Observer<[CanvasDimensions]>

options? ​

SubscriptionOptions

Returns ​

(): void

Returns ​

void

Implementation of ​

Observable.subscribe


tearDown() ​

tearDown(): void

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

Cleanup method to dispose of resources and event listeners

Returns ​

void

Implementation of ​

Canvas.tearDown