RoofComponent2D Class
2D Roof Edition Component.
Constructor
RoofComponent2D
-
core
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Methods
adjustOverhangs
-
[ref]
Adjusts all overhangs so they fit with neighbors' overhangs
Parameters:
-
[ref]
RoofStructure optionalReference roof with which all other overhangs must fit (default is roof with smallest overhang)
closeAllRoofCuts
()
private
Close any open roof popups.
destroy
()
disable
()
drawMeasures
-
ctx
-
translation
-
zoom
-
roof
Draws measures of the roof overhangs.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
roof
RoofStructurethe roof for which to draw the overhang measures.
drawRoof
-
ctx
-
translation
-
zoom
-
roof
Draws a roof as a polygon. If hovered by the mouse, enlarge line width on relevant overhang.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
roof
RoofStructureThe RoofStructure.
enable
()
getTargeted
-
vector
Parameters:
-
vector
VectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
initialize
()
insertRaccordPoints
-
origpoints
-
points
-
raccord
Inserts points of connection in parameter to roof points
Parameters:
-
origpoints
BABYLON.Vector2array of points of the roof before computing connections.
-
points
BABYLON.Vector2array of points of the roof (already with some connections).
-
raccord
BABYLON.Vector2[]the connection to add to the points array.
joinAllRoofs
-
subSlopes
Compute roof offets so that opposite roofs extend to form a ridge
Parameters:
-
subSlopes
SubSlopeStructure[]list of subslopes in the floor
onContextChanged
-
context
Parameters:
-
context
StringThe new context
onContextMenu
-
event
-
target
-
mstate
-
data
When the popup of the roof has to be opened.
Parameters:
-
event
EventThe JS event.
-
target
RoofStructureThe roof structure hovered by the mouse.
-
mstate
ObjectThe state of the mouse.
-
data
ObjectData used for the drawing. Can be null or something else if you wish to override the function.
onDragEnd
-
event
-
target
-
mstate
-
data
When the mouse stops dragging the roof.
Parameters:
-
event
EventThe JS event.
-
target
RoofStructureThe roof structure.
-
mstate
ObjectThe state of the mouse.
-
data
ObjectData used for the drawing. Can be null or something else if you wish to override the function.
onDragging
-
event
-
target
-
mstate
-
data
When the mouse is dragging the roof. Applies magnetism on overhangs.
Parameters:
-
event
EventThe JS event.
-
target
RoofStructureThe roof structure dragged by the mouse.
-
mstate
ObjectThe state of the mouse.
-
data
ObjectData used for the drawing. Can be null or something else if you wish to override the function.
onDragStart
-
event
-
target
-
mstate
-
data
When the mouse begins to drag the roof.
Parameters:
-
event
EventThe JS event.
-
target
RoofStructureThe roof structure dragged by the mouse.
-
mstate
ObjectThe state of the mouse.
-
data
ObjectData used for the drawing. Can be null or something else if you wish to override the function.
onHover
-
event
-
target
-
mstate
-
data
When the mouse hovers the roof (overhangs only because inside is managed by subslopeComponent).
Parameters:
-
event
EventThe JS event.
-
target
RoofStructureThe roof structure dragged by the mouse.
-
mstate
ObjectThe state of the mouse.
-
data
ObjectData used for the drawing. Can be null or something else if you wish to override the function.
onLeave
-
event
-
target
-
mstate
-
data
When the mouse leaves the roof.
Parameters:
-
event
EventThe JS event.
-
target
RoofStructureThe roof structure dragged by the mouse.
-
mstate
ObjectThe state of the mouse.
-
data
ObjectData used for the drawing. Can be null or something else if you wish to override the function.
onStaticDraw
-
ctx
-
translation
-
zoom
Draws the roofs.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.