ue-too
Version:
pan, zoom, and rotate your html canvas
55 lines (54 loc) • 1.91 kB
TypeScript
import { Observer, SubscriptionOptions } from "../../utils/observable";
export type Rotation = number;
export type RotationVelocity = number;
export type RotationDestinationUpdate = {
type: 'destination';
destination: Rotation;
};
export type RotationDeltaUpdate = {
type: 'delta';
delta: Rotation;
};
export type RotationUpdate = RotationDestinationUpdate | RotationDeltaUpdate;
export declare class CameraRotationUpdateBatcher {
private nextRotation;
private delta;
private observable;
private queueRotationUpdateCount;
private queueRotationUpdateToCount;
private queueRotationUpdateByCount;
private lastUpdateCount;
constructor();
/**
* Queue an absolute rotation update to be processed in the next animation frame
*/
queueRotationUpdate(rotation: Rotation): void;
/**
* Queue a rotation update to a specific destination to be processed in the next animation frame
* This will override any pending delta updates
*/
queueRotationUpdateTo(destination: Rotation): void;
/**
* Queue a rotation update by delta to be processed in the next animation frame
* This will be ignored if there's a pending destination update
*/
queueRotationUpdateBy(delta: Rotation): void;
/**
* Process and clear all queued rotation updates
* @returns the update to apply to the rotation, with type information
*/
processQueuedUpdates(): RotationUpdate | null;
/**
* Subscribe to rotation updates
*/
subscribe(observer: Observer<[RotationUpdate]>, options?: SubscriptionOptions): () => void;
/**
* Get debug information about queue method calls since last update
*/
getDebugInfo(): {
lastUpdateTotalCalls: number;
queueRotationUpdateCalls: number;
queueRotationUpdateToCalls: number;
queueRotationUpdateByCalls: number;
};
}