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:
-
core
CoreWanaplan 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:
-
swimmingPool
SwimmingPoolStructureThe 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:
-
swimmingPool
SwimmingPoolStructureThe swimmingPool structure.
-
ctx
Context2DThe 2d context.
-
translation
BABYLON.Vector2The translation of the canvas.
-
zoom
NumberThe zoom level of the canvas.
-
selected
BooleanTrue if the swimmingPool is currently selected, else false.
draw
Syntax
draw
-
swimmingPool
-
ctx
-
translation
-
zoom
-
selected
Summary
Draws the thickness of the swimmingPool.
Parameters:
-
swimmingPool
SwimmingPoolStructureThe swimmingPool structure.
-
ctx
Context2DThe 2d context.
-
translation
BABYLON.Vector2The translation of the canvas.
-
zoom
NumberThe zoom level of the canvas.
-
selected
BooleanTrue 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:
-
swimmingPool
SwimmingPoolStructureThe swimmingPool structure.
-
ctx
Context2DThe 2d context.
-
zoom
NumberThe 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:
-
vector
VectorA 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:
-
vector
BABYLON.Vector2The point.
-
swimmingPool
SwimmingPoolStructureThe 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:
-
vector
BABYLON.Vector2The point.
-
swimmingPool
SwimmingPoolStructureThe swimmingPool structure.
onAddSwimmingPool
Syntax
onAddSwimmingPool
-
event
Summary
Create a new SwimmingPoolStructure
Parameters:
-
event
EventThe event caught.
onAddSwimmingPoolClick
Syntax
onAddSwimmingPoolClick
-
event
-
target
-
mstate
-
data
Summary
Adds a new swimmingPool on click.
Triggered on event swimmingPoolComponent2D.add-swimmingPool.click
Parameters:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure added.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant data used to draw.
onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context
onContextMenu
Syntax
onContextMenu
-
event
-
target
-
mstate
-
data
Summary
Opens the context menu of the swimmingPool.
Triggered on event swimmingPoolComponent2D.swimmingPool.click
Parameters:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
target
SwimmingPoolStructureThe swimmingPool structure.
-
property
StringThe property changed.
-
value
Number | StringThe new value.
onContextMenuRemove
Syntax
onContextMenuRemove
-
target
Summary
Called when the user closes the context menu.
Parameters:
-
target
SwimmingPoolStructureThe 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.dblclick
swimmingPool
Parameters:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure clicked.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure dragged.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure dragged.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure dragged.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure hovered.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure leaved.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
event
EventThe event caught.
-
target
SwimmingPoolStructureThe swimmingPool structure moved.
-
mstate
ObjectThe current state of the pointer.
-
data
ObjectImportant 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:
-
sp
SwimmingPoolStructureThe swimmingPool structure to update.