@itwin/core-markup
Version:
iTwin.js markup package
47 lines • 2.33 kB
TypeScript
/** @packageDocumentation
* @module MarkupTools
*/
import { Element as MarkupElement } from "@svgdotjs/svg.js";
/** Stores the sequence of operations performed on a Markup. Facilitates undo/redo of the operations.
* @public
*/
export declare class UndoManager {
private _currentCmd;
private _grouped;
private _stack;
private _currentPos;
private _cmdName;
private addAction;
/** @internal */
get size(): number;
private startCommand;
private startGroup;
private endGroup;
/** Perform a series of changes to markup elements that should all be reversed as a single operation.
* @param fn the function that performs the changes to the elements. It must call the onXXX methods of this class to store
* the operations in the undo buffer.
* @note all of the onXXX methods of this class should *only* be called from within the callback function of this method.
*/
performOperation(cmdName: string, fn: VoidFunction): void;
/** call this from within a [[performOperation]] function *after* an element has been added to a markup */
onAdded(elem: MarkupElement): void;
/** call this from within a [[performOperation]] function *before* an element is about to be deleted from a markup */
onDelete(elem: MarkupElement): void;
/** call this from within a [[performOperation]] function *after* an element has been moved in display order in a markup */
onRepositioned(elem: MarkupElement, oldIndex: number, oldParent: MarkupElement): void;
/** call this from within a [[performOperation]] function *after* an element has been modified in a markup */
onModified(newElem: MarkupElement, oldElem: MarkupElement): void;
/** determine whether there are any un-reversed operations */
get undoPossible(): boolean;
/** determine whether there are any reversed operations */
get redoPossible(): boolean;
/** the name of the operation that can be undone (or undefined) */
get undoString(): string | undefined;
/** the name of the operation that can be redone (or undefined) */
get redoString(): string | undefined;
/** reverse the most recent operation, if any */
doUndo(): void;
/** reinstate the most recently reversed operation, if any */
doRedo(): void;
}
//# sourceMappingURL=Undo.d.ts.map