@ue-too/board / SvgProxy
Class: SvgProxy
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:349
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:357
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:409
Whether the canvas is currently detached from the DOM
Returns
boolean
Whether the canvas is currently detached from the DOM
Implementation of
dimensions
Get Signature
get dimensions():
object
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:413
Combined dimensions and position information
Returns
object
height
height:
number
position
position:
Point
width
width:
number
Combined dimensions and position information
Implementation of
height
Get Signature
get height():
number
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:445
The canvas height in CSS pixels
Returns
number
The canvas height in CSS pixels
Implementation of
position
Get Signature
get position():
Point
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:449
The top-left position of the canvas in window coordinates
Returns
Point
The top-left position of the canvas in window coordinates
Implementation of
width
Get Signature
get width():
number
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:421
The canvas width in CSS pixels
Returns
number
The canvas width in CSS pixels
Implementation of
Methods
attach()
attach(
svg):void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:467
Parameters
svg
SVGSVGElement
Returns
void
logCanvasTrueSize()
logCanvasTrueSize():
void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:487
Returns
void
notify()
notify(...
data):void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:405
Parameters
data
...[CanvasDimensions]
Returns
void
Implementation of
setCursor()
setCursor(
style):void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:453
Sets the CSS cursor style for visual feedback
Parameters
style
"grab" | "default" | "grabbing"
Returns
void
Implementation of
setHeight()
setHeight(
height):void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:439
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:429
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:398
Parameters
observer
options?
Returns
():
void
Returns
void
Implementation of
tearDown()
tearDown():
void
Defined in: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:459
Cleanup method to dispose of resources and event listeners
Returns
void