SubSlopeOvertureComponent2D
Summary
Manages subslope overtures in 2D.
Constructor
SubSlopeOvertureComponent2D
Syntax
SubSlopeOvertureComponent2D
-
core
Summary
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
- appliedMagnetism
- appliedSideMagnetism
- calculateDistance
- changeAddStateSubSlopeOverture
- changeAddStateVelux
- checkCoherence
- destroy
- disable
- draw
- drawCotes
- drawCotesSS
- drawMagnetism
- drawTarget
- enable
- getIntersectPoint
- getTargeted
- initialize
- isInSubSlope
- isPointInOvertureSide
- onContextChanged
- reorganizeSubslopes
- startListening
- stopListening
- update
Properties
Methods
appliedMagnetism
Syntax
appliedMagnetism
-
subslopeOV
-
subslope
-
normalVector
-
colVector
Summary
Puts two overtures at the same height if they are close.
Parameters:
-
subslopeOV
SubSlopeOvertureStructureThe subslope overture selected.
-
subslope
SubSlopeStructureThe subslope of the subslope overture.
-
normalVector
BABYLON.Vector2The normal vector of the wall of the subslope.
-
colVector
BABYLON.Vector2A vector colinear to the wall vector.
appliedSideMagnetism
Syntax
appliedSideMagnetism
-
subslopeOV
-
subslope
-
normalVector
-
colVector
-
moveVector
Summary
Applies the magnetism on a side of the overture.
Parameters:
-
subslopeOV
SubSlopeOvertureStructureThe subslope overture selected.
-
subslope
SubSlopeStructureThe subslope of the subslope overture.
-
normalVector
BABYLON.Vector2The normal vector of the wall of the subslope.
-
colVector
BABYLON.Vector2A vector colinear to the wall vector.
-
moveVector
BABYLON.Vector2The movement vector done with the cursor.
calculateDistance
Syntax
Summary
Computes the distance on the canvas between two subslope overtures.
Parameters:
-
subslopeOV
SubSlopesOvertureStructureThe 1st overture structure.
-
subslopeOV2
SubSlopesOvertureStructureThe 2nd overture structure.
-
Vector
BABYLON.Vector2The vector.
-
number
NumberCheck the size we have to change.
Returns:
The distance between the subslope overture.
changeAddStateSubSlopeOverture
Syntax
changeAddStateSubSlopeOverture
()
private
Summary
When the user changes the type of overture, we change the event.
changeAddStateVelux
Syntax
changeAddStateVelux
()
private
Summary
When the user changes the type of overture, we change the event.
checkCoherence
Syntax
checkCoherence
-
data
Summary
Checks the size of the overture : Must be positive.
Parameters:
-
data
ObjectThe size of the subslope overture.
destroy
Syntax
destroy
()
Summary
Method called when the component is destroyeddisable
Syntax
disable
()
Summary
Disables the componentdraw
Syntax
draw
-
overture
-
ctx
-
translation
-
zoom
-
selected
Summary
Draws an overture on the subslope.
Parameters:
-
overture
SubSlopeOvertureStructureThe overture which has to be drawn.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
selected
BooleanThe overture is selected or not.
drawCotes
Syntax
drawCotes
-
ssOv1
-
ssOv2
-
ctx
-
translation
-
zoom
-
value
Summary
Draws the distance between 2 overtures.
Parameters:
-
ssOv1
SubSlopeOvertureStructureThe 1st subslope overture.
-
ssOv2
SubSlopeOvertureStructureThe second subslope overture.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
value
NumberThe value to draw.
drawCotesSS
Syntax
drawCotesSS
-
ssOv
-
subslope
-
ctx
-
translation
-
zoom
-
value
-
vector
Summary
Draws the distance between a subslope overture and the closest side of a subslope.
Parameters:
-
ssOv
SubSlopeOvertureStructureThe subslope overture.
-
subslope
SubSlopeStructureThe subslope of the overture.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
-
value
NumberThe index point of the subslope.
-
vector
BABYLON.Vector2The vector.
drawMagnetism
Syntax
drawMagnetism
-
ssOv1
-
ssOv2
-
ctx
-
translation
-
zoom
Summary
Draws a line between the positions of 2 overtures with the magnetism.
Parameters:
-
ssOv1
SubSlopeOvertureStructureThe 1st subslope overture.
-
ssOv2
SubSlopeOvertureStructureThe second subslope overture.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
translation
BABYLON.Vector2The translation on the canvas.
-
zoom
NumberThe current zoom of the canvas.
drawTarget
Syntax
drawTarget
-
subslopeOverture
-
ctx
-
zoom
Summary
Draws the target : the subslope overture on the canvas.
Parameters:
-
subslopeOverture
SubSlopeOvertureStructureThe subslope overture structure.
-
ctx
CanvasRenderingContext2DContext 2D of the canvas.
-
zoom
NumberThe current zoom of the canvas.
enable
Syntax
enable
()
Summary
Enables the componentgetIntersectPoint
Syntax
getIntersectPoint
-
subslopeOV
-
subslope
-
Vector
-
number
-
The
Summary
Returns the point resulting from the intersection of a subslopeOverture and a subslope.
Parameters:
-
subslopeOV
SubSlopeOvertureStructureThe overture structure.
-
subslope
SubSlopeStructureThe subslope.
-
Vector
BABYLON.Vector2The vector.
-
number
NumberCheck the size we have to change.
-
The
BABYLON.Vector2intersection.
getTargeted
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.isInSubSlope
Syntax
isInSubSlope
-
ssCoord
-
ssOvCoord
Summary
Returns true if the given subslope overture is inside the subslope's polygon
Parameters:
-
ssCoord
BABYLON.Vector2Array of the polygon points of the subslope.
-
ssOvCoord
BABYLON.Vector2Array of the polygon points of the subslope overture.
isPointInOvertureSide
Syntax
isPointInOvertureSide
-
vector
-
overture
Summary
Checks if a point is nearby the side of a subslope overture.
Parameters:
-
vector
BABYLON.Vector2Involved point.
-
overture
SubSlopeOvertureStructureThe subslope overture structure.
onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context
reorganizeSubslopes
Syntax
reorganizeSubslopes
-
ssArray
-
subslope
-
vector
Summary
Reorganizes the overtures of a subslope.
Parameters:
-
ssArray
SubSlopeOvertureStructure[]Array of all the overtures of a subslope.
-
subslope
SubSlopeStructureThe subslope.
-
vector
BABYLON.Vector2The vector of the wall.
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
_overture1Magnetism
Syntax
Summary
Dragged subslopeOverture (useful for drawing Magnetism)
_overture2Magnetism
Syntax
Summary
Other subslopeOverture for drawing Magnetism
_targetedAtSide
Syntax
Summary
The id of the selected side of the subslopeOverture
_tmpOverture
Syntax
Summary
Temporary overture when adding a new overture
priority
Syntax
Summary
Priority of the component for update callbacks.
Default: 99
priority
Syntax
Summary
The state of the SubslopeOverture. 1 if in add mode, 0 otherwise
structure
Syntax
structure
wnp.Structure
Summary
Structure file instance (shortcut to wanaplan.structure). This is the base object where the whole plan is savedEvents
wnp.engine2d.onAddSubSlopeOverture
Syntax
wnp.engine2d.onAddSubSlopeOverture
Summary
Fired when the user requests the addition of a subslopeOverture (click on the button)
wnp.engine2d.onEditSubSlope
Syntax
wnp.engine2d.onEditSubSlope
Summary
Fired when the user enters the subslope edit mode.
wnp.engine2d.onModeSubSlopeEnd
Syntax
wnp.engine2d.onModeSubSlopeEnd
Summary
Fired when the user quits the subslope edit mode.