OvertureComponent2D Class
Overture component 2D.
Constructor
OvertureComponent2D
-
core
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
- _drawOverture
- compute
- destroy
- disable
- enable
- getTargeted
- initialize
- onAddOverture
- onAddOvertureDragStart
- onAddOvertureEnd
- onAddOvertureLeaveZone
- onAddOvertureUpdate
- onContextChanged
- onContextMenu
- onContextMenuPropertyChanged
- onContextMenuRemove
- onDoubleClick
- onDragEnd
- onDraggingMove
- onDraggingResize
- onDragStart
- onHover
- onLeave
- onSelectionDynamicDraw
- onStaticDraw
- startListening
- stopListening
- update
Methods
_drawOverture
-
ctx
-
translation
-
zoom
-
data
Draws an overture.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
data
ObjectImportant data used for drawing (null).
compute
()
Checks that overtures are well parented with their parent wall.
destroy
()
disable
()
enable
()
getTargeted
-
vector
Tests if the cursor is on one of the overtures element, and if so returns it.
Parameters:
-
vector
BABYLON.Vector2The vector representing the coordinates of the cursor.
Returns:
The target or null if nothing is under the cursor.
initialize
()
Initializes the overture menu.
onAddOverture
-
event
Adds an overture.
Triggered on event wnp.engine2d.onAddOverture
Parameters:
-
event
EventThe event received with the basic overture parameters.
onAddOvertureDragStart
-
event
-
target
-
mstate
-
data
Called when dragging an added overture.
onAddOvertureEnd
-
event
-
target
-
mstate
-
data
Called when the action to add an overture is done.
Triggered on wnp.engine2d.onAddOvertureEnd
onAddOvertureLeaveZone
-
event
-
data
Unregisters the pointer events when the action to add an overture is done and the cursor leaves the zone.
onAddOvertureUpdate
-
event
-
target
-
mstate
-
data
Called when updating an added overture.
onContextChanged
-
context
Parameters:
-
context
StringThe new context
onContextMenu
-
event
-
target
-
mstate
-
data
Handles all the items of the context menu.
Triggered on event OvertureComponent2D.context-menu
Parameters:
-
event
EventThe event caught.
-
target
OvertureStructureThe overture structure hovered by the mouse.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant data used for drawing (null).
onContextMenuPropertyChanged
-
event
-
property
-
value
Called when the value of a context menu property is changed.
onContextMenuRemove
-
target
Called when the user removes the context menu.
Parameters:
-
target
OvertureStructureThe overture structure concerned.
onDoubleClick
-
event
-
target
-
mstate
-
data
Duplicates an overture on double click.
Triggered on event OvertureComponent2D.double-click
onDragEnd
-
event
-
target
-
mstate
-
data
When the dragging ends.
onDraggingMove
-
event
-
target
-
mstate
-
data
When an overture is moved by dragging the cursor.
Parameters:
Returns:
false
onDraggingResize
-
event
-
target
-
mstate
-
data
When an overture is resized by dragging the cursor.
Parameters:
Returns:
false
onDragStart
-
event
-
target
-
mstate
-
data
Handles the movement and reshaping of the overture.
Triggered on event OvertureComponent2D.drag-start
Parameters:
-
event
EventThe event caught.
-
target
OvertureStructureThe overture structure dragged.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant data used for drawing.
Returns:
false
onHover
-
event
-
target
-
mstate
-
data
When an overture is hovered by the mouse.
Triggered on event OvertureComponent2D.hover
onLeave
-
event
-
target
-
mstate
-
data
When an overture is leaved by the mouse.
Triggered on event OvertureComponent2D.leave
onSelectionDynamicDraw
-
ctx
-
translation
-
zoom
-
data
Dynamic draw.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
data
ObjectImportant data used for drawing (null).
onStaticDraw
-
ctx
-
translation
-
zoom
-
data
Static draw.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
data
ObjectImportant data used for drawing (null).
startListening
()
stopListening
()
update
()
Properties
structure
wnp.Structure
Events
wnp.engine2d.onAddOverture
Fired when the action to add an overture is started.
wnp.engine2d.onAddOvertureEnd
Fired when the action to add an overture is done.