StairwayComponent2D Class
Stairway Component 2D.
Constructor
StairwayComponent2D
-
core
Parameters:
-
core
wnp.CoreWanaplan.
Item Index
Methods
- destroy
- disable
- draw
- drawTargetSpiral
- drawTargetSpiral
- enable
- finalizeTmpStairway
- getTargeted
- initialize
- onAddStairway
- onAddStairwayClick
- onContextChanged
- onContextMenu
- onContextMenuPropertyChanged
- onContextMenuRemove
- onDoubleClick
- onDragEnd
- onDragStair
- onDragStairSpiral
- onDragStart
- onDrawDragging
- onDrawDragStart
- onDynamicDraw
- onFloorAdded
- onHover
- onHoverStair
- onHoverStairMouseMove
- onLeave
- onMouseMove
- onMouseMove
- onStaticDraw
- onStructureLoaded
- startListening
- stopListening
- update
Events
Methods
destroy
()
disable
()
draw
-
stairway
-
ctx
-
translation
-
zoom
-
tmpPoint
Draws a stairway.
Parameters:
-
stairway
StairwayStructureThe stairway structure.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
tmpPoint
BABYLON.Vector2The tamporary point.
drawTargetSpiral
-
stairway
-
ctx
-
translation
-
zoom
Draw a stairway.
Parameters:
-
stairway
StairwayStructureThe stairway structure.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
drawTargetSpiral
-
stairway
-
ctx
-
translation
-
zoom
Draw a spiral stairway.
Parameters:
-
stairway
StairwayStructureThe stairway structure.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
enable
()
finalizeTmpStairway
()
private
Finalizes to build the stairway, and creates the hopper.
getTargeted
-
vector
Parameters:
-
vector
VectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
initialize
()
onAddStairway
-
event
Add a stairway.
Parameters:
-
event
EventThe event receive with the basics data.
onAddStairwayClick
-
event
-
target
-
mstate
-
data
When the user add a point on the stairway with a simple click.
onContextChanged
-
context
Parameters:
-
context
StringThe new context
onContextMenu
-
event
-
target
-
mstate
-
data
Handle all the item of the context menu.
onContextMenuPropertyChanged
-
event
-
target
-
value
When a value is changed.
Parameters:
-
event
EventThe event catch.
-
target
StairwayStructureThe stairway structure changed value.
-
value
Number | StringThe changed value.
onContextMenuRemove
-
target
When the user remove the context menu.
Parameters:
-
target
StairwayStructureThe subslope overture structure changed value.
onDoubleClick
-
event
-
target
-
mstate
-
data
When the user double-clicks on the stairway, adds a new point.
onDragEnd
-
event
-
target
-
mstate
-
data
When the user finish to drag the stairway.
onDragStair
-
event
-
target
-
mstate
-
data
When the user drag a spiral stair.
onDragStairSpiral
-
event
-
target
-
mstate
-
data
When the user drag a spiral stair.
onDragStart
-
event
-
target
-
mstate
-
data
When the user start to drag the stair.
onDrawDragging
-
event
-
target
-
mstate
-
data
Draws the stair when the user drag the stairway.
onDrawDragStart
-
event
-
target
-
mstate
-
data
Method call only on the drag start when the user draw, it allow to simulate a pen to draw the stairway.
onDynamicDraw
-
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 the draw (null).
onFloorAdded
-
event
When the user adds a floor, the engine looks for the stairway in floor below and computes the hopper.
Parameters:
-
event
EventThe associated event.
onHover
-
event
-
target
-
mstate
-
data
When hover.
onHoverStair
-
ctx
-
translation
-
zoom
-
data
When the user hovers the stairway.
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 the draw (null).
onHoverStairMouseMove
-
event
-
target
-
mstate
-
data
When the user hover the stairway with the cursor.
onLeave
-
event
-
target
-
mstate
-
data
When the user leaves the stairway.
Parameters:
Returns:
false
onMouseMove
-
event
-
target
-
mstate
-
data
On the mousemove, in draw state, we create the temporary point (perpendicular to the last segment).
onMouseMove
-
origin
-
stairway
Add the magnetism on the stairway.
Parameters:
-
origin
BABYLON.Vector2The origin of the point.
-
stairway
BABYLON.stairwayStructureThe stairway structure.
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 the draw (null).
onStructureLoaded
()
private
When the structure is loaded, we check the coherency of the structure.