HistoryComponent
Summary
Component which handles the history of undos and redos.
Constructor
HistoryComponent
Syntax
HistoryComponent
-
core
Summary
Parameters:
-
coreCoreThe engine.
Item Index
Methods
Properties
Methods
actionDone
Syntax
actionDone
-
target -
params -
type -
component
Summary
Adds a user action to the history.
Parameters:
-
targetObjectThe target object, can be anything that is concerned by the action.
-
paramsObjectA set of parameters to pass to the undo/redo functions.
-
typeStringType of the action.
-
componentBaseComponent2D | 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:
-
contextStringThe new context
onHistoryActionRequest
Syntax
onHistoryActionRequest
-
event
Summary
Calls the component's addHistory method.
Triggered on event wnp.request.historyAction.
Parameters:
-
eventEventThe 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:
-
eventEventEvent caught.
register
Syntax
register
-
component
Summary
Registers a component so that it can use undo and redo capabilities.
Parameters:
-
componentBaseComponent2D | BaseComponent3DThe involved component.
registerAction
Syntax
registerAction
-
type -
undoFunction -
redoFunction -
component
Summary
Saves an action which can be undone or redone.
Parameters:
-
typeStringType of the action.
-
undoFunctionFunctionThe function called to handle the ctrl-z (undo). This function must have 2 parameters :
targetThe target object, can be anything that is concerned by the actionparamsA set of parameters. These will need to be passed as the argumentparamswhen callingactionDone.
-
redoFunctionFunctionThe function called to handle the ctrl-y (redo).
-
componentBaseComponent2D | 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:
-
deltaTimeNumberThe time interval.