SubSlopeOvertureComponent2D Class
Manages subslope overtures in 2D.
Constructor
SubSlopeOvertureComponent2D
-
core
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
-
subslopeOV
-
subslope
-
normalVector
-
colVector
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
-
subslopeOV
-
subslope
-
normalVector
-
colVector
-
moveVector
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
-
subslopeOV
-
subslopeOV2
-
Vector
-
number
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
()
private
When the user changes the type of overture, we change the event.
changeAddStateVelux
()
private
When the user changes the type of overture, we change the event.
checkCoherence
-
data
Checks the size of the overture : Must be positive.
Parameters:
-
data
ObjectThe size of the subslope overture.
destroy
()
disable
()
draw
-
overture
-
ctx
-
translation
-
zoom
-
selected
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
-
ssOv1
-
ssOv2
-
ctx
-
translation
-
zoom
-
value
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
-
ssOv
-
subslope
-
ctx
-
translation
-
zoom
-
value
-
vector
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
-
ssOv1
-
ssOv2
-
ctx
-
translation
-
zoom
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
-
subslopeOverture
-
ctx
-
zoom
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
()
getIntersectPoint
-
subslopeOV
-
subslope
-
Vector
-
number
-
The
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
-
vector
Parameters:
-
vector
VectorA position, usually the cursor's one.
Returns:
The targeted element, or null if nothing is found.
initialize
()
isInSubSlope
-
ssCoord
-
ssOvCoord
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
-
vector
-
overture
Checks if a point is nearby the side of a subslope overture.
Parameters:
-
vector
BABYLON.Vector2Involved point.
-
overture
SubSlopeOvertureStructureThe subslope overture structure.
onContextChanged
-
context
Parameters:
-
context
StringThe new context
reorganizeSubslopes
-
ssArray
-
subslope
-
vector
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
()
stopListening
()
update
()
Properties
_overture1Magnetism
SubSlopeOvertureStructure[]
private
Dragged subslopeOverture (useful for drawing Magnetism)
_overture2Magnetism
SubSlopeOvertureStructure[]
private
Other subslopeOverture for drawing Magnetism
structure
wnp.Structure
Events
wnp.engine2d.onAddSubSlopeOverture
Fired when the user requests the addition of a subslopeOverture (click on the button)
wnp.engine2d.onEditSubSlope
Fired when the user enters the subslope edit mode.
wnp.engine2d.onModeSubSlopeEnd
Fired when the user quits the subslope edit mode.