UNPKG

@niuee/board

Version:

<h1 align="center"> board </h1> <p align="center"> board supercharges your html canvas element giving it the capabilities to pan, zoom, rotate, and much more. </p> <p align="center"> <a href="https://www.npmjs.com/package/@niuee/board">

41 lines (40 loc) 1.53 kB
import { Point } from "../util/misc"; import { BaseContext } from "../being"; import { RawUserInputPublisher } from "../raw-input-publisher/raw-input-publisher"; /** * @description The context for the keyboard mouse and trackpad input state machine. * * @category Input State Machine */ export interface KmtInputContext extends BaseContext { alignCoordinateSystem: boolean; canvas: HTMLCanvasElement; notifyOnPan: (delta: Point) => void; notifyOnZoom: (zoomAmount: number, anchorPoint: Point) => void; notifyOnRotate: (deltaRotation: number) => void; setInitialCursorPosition: (position: Point) => void; initialCursorPosition: Point; } /** * @description The observable input tracker. * This is used as the context for the keyboard mouse and trackpad input state machine. * * @category Input State Machine */ export declare class ObservableInputTracker implements KmtInputContext { private _alignCoordinateSystem; private _canvas; private _inputPublisher; private _initialCursorPosition; constructor(canvas: HTMLCanvasElement, inputPublisher: RawUserInputPublisher); get alignCoordinateSystem(): boolean; get canvas(): HTMLCanvasElement; get initialCursorPosition(): Point; set alignCoordinateSystem(value: boolean); notifyOnPan(delta: Point): void; notifyOnZoom(zoomAmount: number, anchorPoint: Point): void; notifyOnRotate(deltaRotation: number): void; setInitialCursorPosition(position: Point): void; cleanup(): void; setup(): void; }