ue-too
Version:
pan, zoom, and rotate your html canvas
61 lines (60 loc) • 2.02 kB
TypeScript
import { Observer, SubscriptionOptions } from "../../utils/observable";
import { Point } from "../../utils/misc";
export type DestinationZoomUpdate = {
type: 'destination';
destination: number;
anchor?: Point;
};
export type DeltaZoomUpdate = {
type: 'delta';
delta: number;
anchor?: Point;
};
export type ZoomUpdate = {
anchorCoordinateSystem: 'world' | 'viewport';
update: DestinationZoomUpdate | DeltaZoomUpdate;
};
export declare class CameraZoomUpdateBatcher {
private nextZoom;
private observable;
private anchor;
private delta;
private anchorCoordinateSystem;
private queueZoomUpdateCount;
private queueZoomUpdateToCount;
private lastUpdateCount;
constructor();
/**
* Queue a zoom update to a specific destination to be processed in the next animation frame
*/
queueZoomUpdateTo(destination: number, anchor?: Point): void;
/**
* Queue a zoom update by delta to be processed in the next animation frame
*/
queueZoomUpdateBy(delta: number, anchor?: Point): void;
/**
* Queue a zoom update by delta at a world anchor to be processed in the next animation frame
*/
queueZoomByAtWorld(delta: number, worldAnchor: Point): void;
/**
* Queue a zoom update to a specific destination at a world anchor to be processed in the next animation frame
*/
queueZoomToAtWorld(destination: number, worldAnchor: Point): void;
/**
* Process and clear all queued zoom updates
* @returns the update to apply to the zoom level, with type information
*/
processQueuedUpdates(): ZoomUpdate | null;
/**
* Subscribe to zoom updates
*/
subscribe(observer: Observer<[ZoomUpdate]>, options?: SubscriptionOptions): () => void;
/**
* Get debug information about queue method calls since last update
*/
getDebugInfo(): {
lastUpdateTotalCalls: number;
queueZoomUpdateCalls: number;
queueZoomUpdateToCalls: number;
};
}