HistoryComponent Class
Component which handles the history of undos and redos.
Constructor
HistoryComponent
-
core
Parameters:
-
core
CoreThe engine.
Item Index
Methods
Properties
Methods
actionDone
-
target
-
params
-
type
-
component
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
()
private
controlY
()
Redoes the last action
controlZ
()
Undoes the last action.
destroy
()
disable
()
enable
()
getFloor
-
[structure]
Parameters:
-
[structure]
FloorStructure optionalThe floor structure.
Returns:
The floor mesh in 3D.
initialize
()
onContextChanged
-
context
Parameters:
-
context
StringThe new context
onHistoryActionRequest
-
event
Calls the component's addHistory method.
Triggered on event wnp.request.historyAction
.
Parameters:
-
event
EventThe JS event.
onKeyDown
-
event
Calls the right action when ctrl-z or ctrl-y is pressed.
Triggered on event wnp.keyboardManager.keyDown
.
Parameters:
-
event
EventEvent caught.
register
-
component
Registers a component so that it can use undo and redo capabilities.
Parameters:
-
component
BaseComponent2D | BaseComponent3DThe involved component.
registerAction
-
type
-
undoFunction
-
redoFunction
-
component
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
()
Resets the entire history.
startListening
()
stopListening
()
update
-
deltaTime
Parameters:
-
deltaTime
NumberThe time interval.