MagnetismComponent2D
Summary
2D Magnetism.
Constructor
MagnetismComponent2D
Syntax
MagnetismComponent2D
-
core
Summary
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Methods
_globalWallMag
Syntax
_globalWallMag
-
wall
-
mstate
Summary
Applies magnetism on the mouse to align walls
Parameters:
-
wall
WallStructurewall to align with
-
mstate
ObjectMouse state
_magFromAngle
Syntax
_magFromAngle
-
mstate
-
target
Summary
Applies mouse magnetism when moving a point to favor 90° and 180° angles.
Parameters:
-
mstate
ObjectMouse state.
-
target
PointStructureDragged point.
_magFromPoints
Syntax
_magFromPoints
-
mstate
-
[ignorePoint]
Summary
Applies magnetism on the mouse according to the existing points on the plan.
Parameters:
-
mstate
ObjectMouse state.
-
[ignorePoint]
PointStructure optionalPoint to ignore.
_magFromWallDir
Syntax
_magFromWallDir
-
mstate
-
target
Summary
Applies mouse magnetism along one of the parent walls' direction when dragging a point.
Parameters:
-
mstate
ObjectMouse state.
-
target
PointStructureDragged point.
_magFromWalls
Syntax
_magFromWalls
-
mstate
-
[wallList]
Summary
Applies magnetism on the mouse according to existing walls on the plan.
Parameters:
-
mstate
ObjectMouse state.
-
[wallList]
WallStructure[] optionallist of walls to consider for magnetism
_shortCircuitMagnetism
Syntax
Summary
Determines if the magnetism must be turned off (short circuited). It happens when the user presses CTRL.
Parameters:
-
mstate
ObjectMouse state.
Returns:
Returns true
if magnetism should be short circuited, false
otherwise.
destroy
Syntax
destroy
()
Summary
Method called when the component is destroyeddisable
Syntax
disable
()
Summary
Disables the componentenable
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.onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context