WanaPlan

API Docs for: 2.7.0
Show:

MagnetismComponent2D

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Summary

2D Magnetism.

Constructor

MagnetismComponent2D

Syntax

MagnetismComponent2D

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

_globalWallMag

Syntax

_globalWallMag

(
  • wall
  • mstate
)
private

Summary

Applies magnetism on the mouse to align walls

Parameters:

_magFromAngle

Syntax

_magFromAngle

(
  • mstate
  • target
)
private

Summary

Applies mouse magnetism when moving a point to favor 90° and 180° angles.

Parameters:

_magFromPoints

Syntax

_magFromPoints

(
  • mstate
  • [ignorePoint]
)
private

Summary

Applies magnetism on the mouse according to the existing points on the plan.

Parameters:

_magFromWallDir

Syntax

_magFromWallDir

(
  • mstate
  • target
)
private

Summary

Applies mouse magnetism along one of the parent walls' direction when dragging a point.

Parameters:

_magFromWalls

Syntax

_magFromWalls

(
  • mstate
  • [wallList]
)
private

Summary

Applies magnetism on the mouse according to existing walls on the plan.

Parameters:

_shortCircuitMagnetism

Syntax

_shortCircuitMagnetism

(
  • mstate
)
Boolean private

Summary

Determines if the magnetism must be turned off (short circuited). It happens when the user presses CTRL.

Parameters:

Returns:

Boolean:

Returns true if magnetism should be short circuited, false otherwise.

destroy

Inherited from BaseComponent2D:

Syntax

destroy

()

Summary

Method called when the component is destroyed

disable

Inherited from BaseComponent2D:

Syntax

disable

()

Summary

Disables the component

enable

Inherited from BaseComponent2D:

Syntax

enable

()

Summary

Enables the component

getTargeted

Inherited from BaseComponent2D:

Syntax

getTargeted

(
  • vector
)
Object

Summary

Finds out if the given position is over an element handled by the component

Parameters:

  • vector Vector

    A position, usually the cursor's one.

Returns:

Object:

The targeted element, or null if nothing is found.

initialize

Inherited from BaseComponent2D:

Syntax

initialize

()

Summary

Method called when Wanaplan is initialized. You don't need to call this method manually.

onContextChanged

Inherited from BaseComponent2D:

Syntax

onContextChanged

(
  • context
)

Summary

Method called when the context is switched (2D -> 3D or 3D -> 2D)

Parameters:

  • context String
    The new context

startListening

Inherited from BaseComponent2D:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent2D:

Syntax

stopListening

()

Summary

Removes all the event listeners.

update

Inherited from BaseComponent2D:

Syntax

update

()

Summary

Generic update method, called on every frame

Properties

name

Inherited from BaseComponent2D:

Syntax

name

String

Summary

Component name

priority

Inherited from BaseComponent2D:

Syntax

priority

Number

Summary

Priority of the component in the "update" and "draw" routines

structure

Inherited from BaseComponent2D:

Syntax

structure

wnp.Structure

Summary

Structure file instance (shortcut to wanaplan.structure). This is the base object where the whole plan is saved