MagnetismComponent2D
Summary
2D Magnetism.
Constructor
MagnetismComponent2D
Syntax
MagnetismComponent2D
-
core
Summary
Parameters:
-
coreCoreThe main engine.
Item Index
Methods
Methods
_globalWallMag
Syntax
_globalWallMag
-
wall -
mstate
Summary
Applies magnetism on the mouse to align walls
Parameters:
-
wallWallStructurewall to align with
-
mstateObjectMouse state
_magFromAngle
Syntax
_magFromAngle
-
mstate -
target
Summary
Applies mouse magnetism when moving a point to favor 90° and 180° angles.
Parameters:
-
mstateObjectMouse state.
-
targetPointStructureDragged point.
_magFromPoints
Syntax
_magFromPoints
-
mstate -
[ignorePoint]
Summary
Applies magnetism on the mouse according to the existing points on the plan.
Parameters:
-
mstateObjectMouse 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:
-
mstateObjectMouse state.
-
targetPointStructureDragged point.
_magFromWalls
Syntax
_magFromWalls
-
mstate -
[wallList]
Summary
Applies magnetism on the mouse according to existing walls on the plan.
Parameters:
-
mstateObjectMouse 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:
-
mstateObjectMouse 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:
-
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.onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
contextStringThe new context