WanaPlan

API Docs for: 2.7.0
Show:

HistoryComponent

Extends BaseComponent3D
Module: Wanaplan

Summary

Component which handles the history of undos and redos.

Constructor

HistoryComponent

Syntax

HistoryComponent

(
  • core
)

Summary

Parameters:

  • core Core

    The engine.

Methods

actionDone

Syntax

actionDone

(
  • target
  • params
  • type
  • component
)

Summary

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

Inherited from BaseComponent3D:

Syntax

compute

() private

Summary

Recompute of the component.

controlY

Syntax

controlY

()

Summary

Redoes the last action

controlZ

Syntax

controlZ

()

Summary

Undoes the last action.

destroy

Inherited from BaseComponent3D:

Syntax

destroy

()

Summary

Destructor.

disable

Inherited from BaseComponent3D:

Syntax

disable

()

Summary

Disables the component

enable

Inherited from BaseComponent3D:

Syntax

enable

()

Summary

Enables the component

getFloor

Inherited from BaseComponent3D:

Syntax

getFloor

(
  • [structure]
)
BABYLON.Mesh

Summary

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:

Syntax

initialize

()

Summary

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

onContextChanged

Inherited from BaseComponent3D:

Syntax

onContextChanged

(
  • context
)

Summary

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

Parameters:

  • context String

    The new context

onHistoryActionRequest

Syntax

onHistoryActionRequest

(
  • event
)
private

Summary

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

Parameters:

  • event Event

    The JS event.

onKeyDown

Syntax

onKeyDown

(
  • event
)

Summary

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

Parameters:

  • event Event

    Event caught.

register

Syntax

register

(
  • component
)

Summary

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

Parameters:

registerAction

Syntax

registerAction

(
  • type
  • undoFunction
  • redoFunction
  • component
)

Summary

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

Syntax

reset

()

Summary

Resets the entire history.

startListening

Inherited from BaseComponent3D:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent3D:

Syntax

stopListening

()

Summary

Removes all the event listeners.

update

Inherited from BaseComponent3D:

Syntax

update

(
  • deltaTime
)

Summary

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

Properties

keyboardManager

Inherited from BaseComponent3D:

Syntax

keyboardManager

wnp.KeyboardManager

Summary

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

name

Inherited from BaseComponent3D:

Syntax

name

String

Summary

Name of the component.

structure

Inherited from BaseComponent3D:

Syntax

structure

wnp.Structure

Summary

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