API Docs for: 2.7.3
Show:

HistoryComponent Class

Extends BaseComponent3D
Module: Wanaplan

Component which handles the history of undos and redos.

Constructor

HistoryComponent

(
  • core
)

Parameters:

  • core Core

    The engine.

Methods

actionDone

(
  • target
  • params
  • type
  • component
)

Adds a user action to the history.

Parameters:

  • target Object

    The target object, can be anything that is concerned by the action.

  • params Object

    A set of parameters to pass to the undo/redo functions.

  • type String

    Type of the action.

  • component BaseComponent2D | BaseComponent3D

    The involved component.

compute

() private

Inherited from BaseComponent3D:

Recompute of the component.

controlY

()

Redoes the last action

controlZ

()

Undoes the last action.

destroy

()

Inherited from BaseComponent3D:

Destructor.

disable

()

Inherited from BaseComponent3D:

Disables the component

enable

()

Inherited from BaseComponent3D:

Enables the component

getFloor

(
  • [structure]
)
BABYLON.Mesh

Inherited from BaseComponent3D:

Gets the 3D mesh of the floor structure in parameter (by default current floor).

Parameters:

Returns:

BABYLON.Mesh:

The floor mesh in 3D.

initialize

()

Inherited from BaseComponent3D:

Method called when Wanaplan is initialized. You don't need to call this method manually.

onContextChanged

(
  • context
)

Inherited from BaseComponent3D:

Method called when the context is switched (2D -> 3D or 3D -> 2D)

Parameters:

  • context String

    The new context

onHistoryActionRequest

(
  • event
)
private

Calls the component's addHistory method. Triggered on event wnp.request.historyAction.

Parameters:

  • event Event

    The JS event.

onKeyDown

(
  • event
)

Calls the right action when ctrl-z or ctrl-y is pressed. Triggered on event wnp.keyboardManager.keyDown.

Parameters:

  • event Event

    Event caught.

register

(
  • component
)

Registers a component so that it can use undo and redo capabilities.

Parameters:

registerAction

(
  • type
  • undoFunction
  • redoFunction
  • component
)

Saves an action which can be undone or redone.

Parameters:

  • type String

    Type of the action.

  • undoFunction Function

    The function called to handle the ctrl-z (undo). This function must have 2 parameters :

    • target The target object, can be anything that is concerned by the action
    • params A set of parameters. These will need to be passed as the argument params when calling actionDone.
  • redoFunction Function

    The function called to handle the ctrl-y (redo).

  • component BaseComponent2D | BaseComponent3D

    The involved component. If it wasn't registered first with register, it will be done here.

reset

()

Resets the entire history.

startListening

()

Inherited from BaseComponent3D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent3D:

Removes all the event listeners.

update

(
  • deltaTime
)

Inherited from BaseComponent3D:

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

Properties

keyboardManager

wnp.KeyboardManager

Inherited from BaseComponent3D:

Instance of the Keyboard Manager (shortcut to wanaplan.keyboardManager).

name

String

Inherited from BaseComponent3D:

Name of the component.

structure

wnp.Structure

Inherited from BaseComponent3D:

Instance of the structure (shortcut to wanaplan.structure).