terra-draw
Version:
Frictionless map drawing across mapping provider
34 lines (33 loc) • 1.14 kB
TypeScript
type UndoRedoHistoryEntry<Coordinates> = {
featureCoordinates: Coordinates;
currentCoordinate: number;
};
type UndoStepResult<Coordinates> = {
undoneEntry: UndoRedoHistoryEntry<Coordinates>;
previousEntry: UndoRedoHistoryEntry<Coordinates> | undefined;
};
type UndoRedoBehaviorOptions = {
maxStackSize?: number;
};
export declare class UndoRedoBehavior<Coordinates> {
private undoHistory;
private redoHistory;
private cloneCoordinatesFunction;
private maxStackSize;
constructor(options?: UndoRedoBehaviorOptions);
setMaxStackSize(maxStackSize: number): void;
private trimHistoryToMax;
private pushUndoEntry;
private pushRedoEntry;
private cloneRecursively;
cloneCoordinates(coordinates: Coordinates): Coordinates;
private cloneEntry;
clear(): void;
undoSize(): number;
redoSize(): number;
recordSnapshot(entry: UndoRedoHistoryEntry<Coordinates>): void;
beginUndo(): UndoStepResult<Coordinates> | undefined;
takeRedo(): UndoRedoHistoryEntry<Coordinates> | undefined;
commitRedo(entry: UndoRedoHistoryEntry<Coordinates>): void;
}
export {};