ThreePipe
    Preparing search index...

    Class UndoManagerPlugin

    UndoManagerPlugin is a plugin for ThreeViewer that provides undo/redo functionality. It uses the JSUndoManager(from ts-browser-helpers) library to maintain a common undo/redo history across the viewer and other plugins.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _dirty: boolean = false
    _viewer?: ThreeViewer
    _viewerListeners: PartialRecord<IViewerEventTypes, (e: IViewerEvent) => void> = {}
    constructor: typeof AViewerPluginSync & typeof AViewerPlugin
    enabled: boolean = true
    limit: number = 1000
    toJSON: any = undefined
    uiConfig?: UiObjectConfig<any, string, any> = undefined
    undoCommandTypes: {
        action: "ThreeViewerUM_action";
        setValue: "ThreeViewerUM_set";
    } = ...
    undoEditingWaitTime: number = 2000
    undoManager?: JSUndoManager
    undoPresets: {
        ThreeViewerUM_action: (
            c: ActionUndoCommand,
        ) => { redo: () => Promise<void>; undo: () => Promise<void> };
        ThreeViewerUM_set: (
            c: SetValueUndoCommand,
        ) => { redo: () => void; undo: () => void };
    } = ...
    OldPluginType?: string
    PluginType: "UndoManagerPlugin" = 'UndoManagerPlugin'

    Accessors

    Methods

    • Performs an action with undo/redo support.

      Type Parameters

      Parameters

      • targ: any

        the target object to call the action on

      • action: T

        a function that returns - 1. an undo function, 2. an object with undo and redo functions (and optional action)

      • args: Parameters<T>

        the arguments to pass to the action function

      • uid: any

        unique identifier for the command, not really used in actions

      • OptionalonUndoRedo: (c: ActionUndoCommand) => void

        optional callback function to be called on undo/redo of the command. Not called on first action execution, only on undo/redo.

      Returns Promise<void>

    • Sets a value in the target object with undo/redo support.

      Type Parameters

      Parameters

      • binding: [T1, keyof T1]

        a tuple of target object and key to set the value on

      • value: T

        the value to set

      • props: SetValueUndoCommandProps<T>

        properties for the undo command, including last, and lastValue(optional)

      • Optionaluid: any

        unique identifier for the command, used to merge commands

      • OptionalforceOnChange: boolean
      • trackUndo: boolean = true

        whether to track the undo command or not, defaults to true

      • OptionalonUndoRedo: (c: SetValueUndoCommand) => void

        optional callback function to be called on undo/redo of the command

      Returns boolean

      true if the value was set and the command was recorded, false if the command was not recorded (e.g. if it was not undoable or forceOnChange was false)