HistoryComponent
Summary
Component which handles the history of undos and redos.
Constructor
HistoryComponent
Syntax
HistoryComponent
-
core
Summary
Parameters:
-
core
CoreThe engine.
Item Index
Methods
Properties
Methods
actionDone
Syntax
actionDone
-
target
-
params
-
type
-
component
Summary
Adds a user action to the history.
Parameters:
-
target
ObjectThe target object, can be anything that is concerned by the action.
-
params
ObjectA set of parameters to pass to the undo/redo functions.
-
type
StringType of the action.
-
component
BaseComponent2D | BaseComponent3DThe involved component.
compute
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
Syntax
destroy
()
Summary
Destructor.disable
Syntax
disable
()
Summary
Disables the componentenable
Syntax
enable
()
Summary
Enables the componentgetFloor
Syntax
getFloor
-
[structure]
Summary
Gets the 3D mesh of the floor structure in parameter (by default current floor).Parameters:
-
[structure]
FloorStructure optionalThe floor structure.
Returns:
The floor mesh in 3D.
initialize
Syntax
initialize
()
Summary
Method called when Wanaplan is initialized. You don't need to call this method manually.onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context
onHistoryActionRequest
Syntax
onHistoryActionRequest
-
event
Summary
Calls the component's addHistory method.
Triggered on event wnp.request.historyAction
.
Parameters:
-
event
EventThe 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
EventEvent caught.
register
Syntax
register
-
component
Summary
Registers a component so that it can use undo and redo capabilities.
Parameters:
-
component
BaseComponent2D | BaseComponent3DThe involved component.
registerAction
Syntax
registerAction
-
type
-
undoFunction
-
redoFunction
-
component
Summary
Saves an action which can be undone or redone.
Parameters:
-
type
StringType of the action.
-
undoFunction
FunctionThe 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 actionparams
A set of parameters. These will need to be passed as the argumentparams
when callingactionDone
.
-
redoFunction
FunctionThe function called to handle the ctrl-y (redo).
-
component
BaseComponent2D | BaseComponent3DThe involved component. If it wasn't registered first with
register
, it will be done here.
reset
Syntax
reset
()
Summary
Resets the entire history.
startListening
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.update
Syntax
update
-
deltaTime
Summary
Updates the dynamic part of the component.Parameters:
-
deltaTime
NumberThe time interval.