ue-too
Version:
pan, zoom, and rotate your html canvas
36 lines (35 loc) • 1.6 kB
TypeScript
import { Point } from "../../utils/misc";
import { TouchPoints } from "./touch-input-state-machine";
import { RawUserInputPublisher } from "../../input-interpretation/raw-input-publisher";
import { BaseContext } from "../../being/interfaces";
import { CanvasOperator } from "./kmt-input-context";
export interface TouchContext extends BaseContext {
addTouchPoints: (points: TouchPoints[]) => void;
removeTouchPoints: (idents: number[]) => void;
getCurrentTouchPointsCount: () => number;
getInitialTouchPointsPositions: (idents: number[]) => TouchPoints[];
updateTouchPoints: (pointsMoved: TouchPoints[]) => void;
notifyOnPan: (delta: Point) => void;
notifyOnZoom: (zoomAmount: number, anchorPoint: Point) => void;
alignCoordinateSystem: boolean;
canvas: CanvasOperator;
}
export declare class TouchInputTracker implements TouchContext {
private _inputPublisher;
private _touchPointsMap;
private _canvas;
private _alignCoordinateSystem;
constructor(canvas: CanvasOperator, inputPublisher: RawUserInputPublisher);
addTouchPoints(points: TouchPoints[]): void;
removeTouchPoints(identifiers: number[]): void;
getCurrentTouchPointsCount(): number;
getInitialTouchPointsPositions(idents: number[]): TouchPoints[];
updateTouchPoints(pointsMoved: TouchPoints[]): void;
notifyOnPan(delta: Point): void;
notifyOnZoom(zoomAmount: number, anchorPoint: Point): void;
get alignCoordinateSystem(): boolean;
set alignCoordinateSystem(value: boolean);
get canvas(): CanvasOperator;
cleanup(): void;
setup(): void;
}