sej
    Preparing search index...

    Class AbstractHistory

    Abstract class for all history implementations.

    Implements

    Index

    Constructors

    Properties

    config?: Config
    editor: Editor

    Pointer to main editor object used to initialize

    historyDisabled: boolean
    idCounter: number
    lastCmdTime: number
    redos: Command[]

    Array of commands that have been undone.

    timeDifferenceLimit: number

    The time difference limit between two commands to be considered as a single command.

    500
    
    undos: Command[]

    Array of commands that have been executed.

    Methods

    • Clears the history by resetting the undo and redo stacks and the ID counter. Also dispatches a signal indicating that the history has changed.

      Returns void

    • Clears the redo stack and dispatches a history changed signal.

      Returns void

      This method resets the redos array to an empty state and notifies the editor that the history has changed by dispatching the historyChanged signal.

    • Enables serialization of commands in the history stack.

      This method ensures that all commands in the undo and redo stacks are serialized by invoking their toJSON method. It temporarily disables the sceneGraphChanged and historyChanged signals to prevent unnecessary updates during the serialization process.

      Parameters

      • id: number

        The state ID to which the history should be restored after serialization.

      Returns void

    • Populates the history state from a JSON object.

      Parameters

      • json: HistoryJSON

        The JSON object containing the history data.

        The method processes the undos and redos arrays from the JSON object, creating command instances and populating the respective history stacks. It also updates the idCounter to the highest command ID found in the JSON data.

        If a command cannot be created from the JSON data, an error is logged to the console.

        Finally, it dispatches a historyChanged signal with the last executed undo-command.

      Returns void

    • Go to a specific state in the history.

      Parameters

      • id: number

        State id to go to

      Returns void

    • E2E test method.

      This method should return true if the test passes, and false if it fails. Check the method itself for more information.

      Returns boolean

    • Converts the current history state to a JSON object.

      Returns HistoryJSON

      The JSON representation of the history, including undos and redos. If the 'settings/history' configuration key is not set, returns an empty history.