RoofComponent2D
Summary
2D Roof Edition Component.
Constructor
RoofComponent2D
Syntax
RoofComponent2D
-
core
Summary
Parameters:
-
coreCoreThe main engine.
Item Index
Methods
Methods
adjustOverhangs
Syntax
adjustOverhangs
-
[ref]
Summary
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
Syntax
closeAllRoofCuts
()
private
Summary
Close any open roof popups.
destroy
Syntax
destroy
()
Summary
Method called when the component is destroyeddisable
Syntax
disable
()
Summary
Disables the componentdrawMeasures
Syntax
drawMeasures
-
ctx -
translation -
zoom -
roof
Summary
Draws measures of the roof overhangs.
Parameters:
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
translationBABYLON.Vector2The translation on the canvas.
-
zoomNumberThe current zoom of the canvas.
-
roofRoofStructurethe roof for which to draw the overhang measures.
drawRoof
Syntax
drawRoof
-
ctx -
translation -
zoom -
roof
Summary
Draws a roof as a polygon. If hovered by the mouse, enlarge line width on relevant overhang.
Parameters:
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
translationBABYLON.Vector2The translation on the canvas.
-
zoomNumberThe current zoom of the canvas.
-
roofRoofStructureThe RoofStructure.
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.insertRaccordPoints
Syntax
insertRaccordPoints
-
origpoints -
points -
raccord
Summary
Inserts points of connection in parameter to roof points
Parameters:
-
origpointsBABYLON.Vector2array of points of the roof before computing connections.
-
pointsBABYLON.Vector2array of points of the roof (already with some connections).
-
raccordBABYLON.Vector2[]the connection to add to the points array.
joinAllRoofs
Syntax
joinAllRoofs
-
subSlopes
Summary
Compute roof offets so that opposite roofs extend to form a ridge
Parameters:
-
subSlopesSubSlopeStructure[]list of subslopes in the floor
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
When the popup of the roof has to be opened.
Parameters:
-
eventEventThe JS event.
-
targetRoofStructureThe roof structure hovered by the mouse.
-
mstateObjectThe state of the mouse.
-
dataObjectData used for the drawing. Can be null or something else if you wish to override the function.
onDragEnd
Syntax
onDragEnd
-
event -
target -
mstate -
data
Summary
When the mouse stops dragging the roof.
Parameters:
-
eventEventThe JS event.
-
targetRoofStructureThe roof structure.
-
mstateObjectThe state of the mouse.
-
dataObjectData used for the drawing. Can be null or something else if you wish to override the function.
onDragging
Syntax
onDragging
-
event -
target -
mstate -
data
Summary
When the mouse is dragging the roof. Applies magnetism on overhangs.
Parameters:
-
eventEventThe JS event.
-
targetRoofStructureThe roof structure dragged by the mouse.
-
mstateObjectThe state of the mouse.
-
dataObjectData used for the drawing. Can be null or something else if you wish to override the function.
onDragStart
Syntax
onDragStart
-
event -
target -
mstate -
data
Summary
When the mouse begins to drag the roof.
Parameters:
-
eventEventThe JS event.
-
targetRoofStructureThe roof structure dragged by the mouse.
-
mstateObjectThe state of the mouse.
-
dataObjectData used for the drawing. Can be null or something else if you wish to override the function.
onHover
Syntax
onHover
-
event -
target -
mstate -
data
Summary
When the mouse hovers the roof (overhangs only because inside is managed by subslopeComponent).
Parameters:
-
eventEventThe JS event.
-
targetRoofStructureThe roof structure dragged by the mouse.
-
mstateObjectThe state of the mouse.
-
dataObjectData used for the drawing. Can be null or something else if you wish to override the function.
onLeave
Syntax
onLeave
-
event -
target -
mstate -
data
Summary
When the mouse leaves the roof.
Parameters:
-
eventEventThe JS event.
-
targetRoofStructureThe roof structure dragged by the mouse.
-
mstateObjectThe state of the mouse.
-
dataObjectData used for the drawing. Can be null or something else if you wish to override the function.
onStaticDraw
Syntax
onStaticDraw
-
ctx -
translation -
zoom
Summary
Draws the roofs.
Parameters:
-
ctxCanvasRenderingContext2DContext 2D of the canvas.
-
translationBABYLON.Vector2The translation on the canvas.
-
zoomNumberThe current zoom of the canvas.
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 frameProperties
displayInfo
Syntax
Summary
If we want to display info on truss roofs or not
Default: true