SwimmingPoolComponent2D
Summary
SwimmingPool 2D. Component which handles :
- actions performed in 2D relatively to the SwimmingPool. Such as :
- adding a SwimmingPool
- displaying the SwimmingPool context menu
- translating the SwimmingPool
- modifying the shape of the SwimmingPool ( moving / adding / removing points / rotating )
- the 2D rendering of the SwimmingPool
Constructor
SwimmingPoolComponent2D
Syntax
SwimmingPoolComponent2D
-
core
Summary
Parameters:
-
coreCoreWanaplan Core.
Item Index
Methods
- changeAddStateSwimmingPool
- compute
- computeSwimmingPool
- destroy
- disable
- draw
- draw
- drawTarget
- enable
- getTargeted
- initialize
- isPointInSwimmingPool
- isPointInSwimmingPoolSide
- onAddSwimmingPool
- onAddSwimmingPoolClick
- onContextChanged
- onContextMenu
- onContextMenuPropertyChanged
- onContextMenuRemove
- onDblClick
- onDrag
- onDragEnd
- onDragStart
- onHover
- onHoverSwimmingPool
- onLeave
- onMouseMove
- startListening
- stopListening
- update
- updateElevation
Methods
changeAddStateSwimmingPool
Syntax
changeAddStateSwimmingPool
()
Summary
Change addstate when adding a temporary swimmingPool
compute
Syntax
compute
()
Summary
Computes all the swimmingPool structures.
computeSwimmingPool
Syntax
computeSwimmingPool
-
swimmingPool
Summary
Checks the swimmingPool consistency and deletes it if the swimmingPool is no longer valid.
- merges vertices that are close enough.
- removes the swimmingPool if it has less than 3 vertices ( invalid swimmingPool ).
Parameters:
-
swimmingPoolSwimmingPoolStructureThe swimmingPool structure to compute.
destroy
Syntax
destroy
()
Summary
Method called when the component is destroyeddisable
Syntax
disable
()
Summary
Disables the componentdraw
Syntax
draw
-
swimmingPool -
ctx -
translation -
zoom -
selected
Summary
Draws the swimmingPool.
Parameters:
-
swimmingPoolSwimmingPoolStructureThe swimmingPool structure.
-
ctxContext2DThe 2d context.
-
translationBABYLON.Vector2The translation of the canvas.
-
zoomNumberThe zoom level of the canvas.
-
selectedBooleanTrue if the swimmingPool is currently selected, else false.
draw
Syntax
draw
-
swimmingPool -
ctx -
translation -
zoom -
selected
Summary
Draws the thickness of the swimmingPool.
Parameters:
-
swimmingPoolSwimmingPoolStructureThe swimmingPool structure.
-
ctxContext2DThe 2d context.
-
translationBABYLON.Vector2The translation of the canvas.
-
zoomNumberThe zoom level of the canvas.
-
selectedBooleanTrue if the swimmingPool is currently selected, else false.
drawTarget
Syntax
drawTarget
-
swimmingPool -
ctx -
zoom
Summary
Draws the swimmingPool guide. It displays visual information on the swimmingPool, depending on the context. Basically, it draws a highlight when the mouse is hovering a swimmingPool element ( the whole swimmingPool, a side , a point, the rotation ring ).
Parameters:
-
swimmingPoolSwimmingPoolStructureThe swimmingPool structure.
-
ctxContext2DThe 2d context.
-
zoomNumberThe zoom level of the canvas.
enable
Syntax
enable
()
Summary
Enables the componentgetTargeted
Syntax
Summary
Finds out if the given position is over an element handled by the componentParameters:
-
vectorVectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
initialize
Syntax
initialize
()
Summary
Method called when Wanaplan is initialized. You don't need to call this method manually.isPointInSwimmingPool
Syntax
Summary
Tests the collision of a point with the area defined by the swimmingPool.
Parameters:
-
vectorBABYLON.Vector2The point.
-
swimmingPoolSwimmingPoolStructureThe swimmingPool structure.
Returns:
True if the point collides, else false.
isPointInSwimmingPoolSide
Syntax
Summary
Tests the collision of a point with the swimmingPool's edges.
Parameters:
-
vectorBABYLON.Vector2The point.
-
swimmingPoolSwimmingPoolStructureThe swimmingPool structure.
onAddSwimmingPool
Syntax
onAddSwimmingPool
-
event
Summary
Create a new SwimmingPoolStructure
Parameters:
-
eventEventThe event caught.
onAddSwimmingPoolClick
Syntax
onAddSwimmingPoolClick
-
event -
target -
mstate -
data
Summary
Adds a new swimmingPool on click.
Triggered on event swimmingPoolComponent2D.add-swimmingPool.click
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure added.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
contextStringThe new context
onContextMenu
Syntax
onContextMenu
-
event -
target -
mstate -
data
Summary
Opens the context menu of the swimmingPool.
Triggered on event swimmingPoolComponent2D.swimmingPool.click
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onContextMenuPropertyChanged
Syntax
onContextMenuPropertyChanged
-
target -
property -
value
Summary
Called when a value is changed in the context menu of the swimmingPool.
Parameters:
-
targetSwimmingPoolStructureThe swimmingPool structure.
-
propertyStringThe property changed.
-
valueNumber | StringThe new value.
onContextMenuRemove
Syntax
onContextMenuRemove
-
target
Summary
Called when the user closes the context menu.
Parameters:
-
targetSwimmingPoolStructureThe swimmingPool structure.
onDblClick
Syntax
onDblClick
-
event -
target -
mstate -
data
Summary
Adds a point on the swimmingPool contour when the user double clicks on it.
Triggered on event SwimmingPoolComponent2D.swimmingPool.dblclickswimmingPool
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure clicked.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onDrag
Syntax
onDrag
-
event -
target -
mstate -
data
Summary
Moves the swimmingPool when it is dragged.
Triggered on event swimmingPoolComponent2D.swimmingPool.drag
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure dragged.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onDragEnd
Syntax
onDragEnd
-
event -
target -
mstate -
data
Summary
Calls computeSwimmingPool when the user stop dragging.
Triggered on event swimmingPoolComponent2D.stair-swimmingPool.drag-end
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure dragged.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onDragStart
Syntax
onDragStart
-
event -
target -
mstate -
data
Summary
Adds new events callbacks when the dragging starts.
Triggered on event swimmingPoolComponent2D.swimmingPool.drag-start
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure dragged.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onHover
Syntax
onHover
-
event -
target -
mstate -
data
Summary
Enables all the possible actions when the mouse hovers the swimmingPool.
Triggered on event swimmingPoolComponent2D.swimmingPool.hover
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure hovered.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onHoverSwimmingPool
Syntax
onHoverSwimmingPool
-
ctx -
translation -
zoom -
data
Summary
Highlights the swimmingPool.
Triggered on event swimmingPoolComponent2D.swimmingPool-hover.dynamic-draw
onLeave
Syntax
onLeave
-
event -
target -
mstate -
data
Summary
Disables all the possible actions when the mouse leaves the swimmingPool.
Triggered on event swimmingPoolComponent2D.swimmingPool.leave
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure leaved.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
onMouseMove
Syntax
onMouseMove
-
event -
target -
mstate -
data
Summary
Moves the new swimmingPool to add when the mouse moves.
Triggered on event swimmingPoolComponent2D.dynamic-stair.mouse-move
Parameters:
-
eventEventThe event caught.
-
targetSwimmingPoolStructureThe swimmingPool structure moved.
-
mstateObjectThe current state of the pointer.
-
dataObjectImportant data used to draw.
startListening
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.update
Syntax
update
()
Summary
Generic update method, called on every frameupdateElevation
Syntax
updateElevation
-
sp
Summary
Raises the elevation of the swimmingPool if necessary.
Parameters:
-
spSwimmingPoolStructureThe swimmingPool structure to update.