RoofComponent2D
Summary
2D Roof Edition Component.
Constructor
RoofComponent2D
Syntax
RoofComponent2D
-
core
Summary
Parameters:
-
core
CoreThe 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:
-
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
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:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
roof
RoofStructureThe RoofStructure.
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.insertRaccordPoints
Syntax
insertRaccordPoints
-
origpoints
-
points
-
raccord
Summary
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
Syntax
joinAllRoofs
-
subSlopes
Summary
Compute roof offets so that opposite roofs extend to form a ridge
Parameters:
-
subSlopes
SubSlopeStructure[]list of subslopes in the floor
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
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
Syntax
onDragEnd
-
event
-
target
-
mstate
-
data
Summary
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
Syntax
onDragging
-
event
-
target
-
mstate
-
data
Summary
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
Syntax
onDragStart
-
event
-
target
-
mstate
-
data
Summary
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
Syntax
onHover
-
event
-
target
-
mstate
-
data
Summary
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
Syntax
onLeave
-
event
-
target
-
mstate
-
data
Summary
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
Syntax
onStaticDraw
-
ctx
-
translation
-
zoom
Summary
Draws the roofs.
Parameters:
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe 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