@ue-too/board / index / CanvasCacheInWebWorker
クラス: CanvasCacheInWebWorker
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:112
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
実装
コンストラクター
コンストラクター
new CanvasCacheInWebWorker(
postMessageFunction):CanvasCacheInWebWorker
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:118
パラメータ
postMessageFunction
{(message, targetOrigin, transfer?): void; (message, options?): void; }
戻り値
CanvasCacheInWebWorker
アクセッサー
detached
署名を取得する
get detached():
boolean
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:163
Whether the canvas is currently detached from the DOM
戻り値
boolean
Whether the canvas is currently detached from the DOM
の実装
dimensions
署名を取得する
get dimensions():
object
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:125
Combined dimensions and position information
戻り値
object
height
height:
number
position
position:
Point
width
width:
number
Combined dimensions and position information
の実装
height
署名を取得する
get height():
number
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:151
The canvas height in CSS pixels
戻り値
number
署名を設定する
set height(
height):void
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:139
The canvas height in CSS pixels
パラメータ
height
number
戻り値
void
The canvas height in CSS pixels
の実装
position
署名を取得する
get position():
Point
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:155
The top-left position of the canvas in window coordinates
戻り値
Point
署名を設定する
set position(
position):void
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:143
The top-left position of the canvas in window coordinates
パラメータ
position
Point
戻り値
void
The top-left position of the canvas in window coordinates
の実装
width
署名を取得する
get width():
number
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:147
The canvas width in CSS pixels
戻り値
number
署名を設定する
set width(
width):void
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:135
The canvas width in CSS pixels
パラメータ
width
number
戻り値
void
The canvas width in CSS pixels
の実装
メソッド
setCursor()
setCursor(
style):void
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:159
Sets the CSS cursor style for visual feedback
パラメータ
style
"grab" | "default" | "grabbing"
戻り値
void
の実装
tearDown()
tearDown():
void
定義: packages/board/src/input-interpretation/input-state-machine/kmt-input-context.ts:133
Cleanup method to dispose of resources and event listeners
戻り値
void