34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
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 {};
|