API Docs for: 2.7.3
Show:

PointComponent2D Class

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Class managing the 2D wall points.

Constructor

PointComponent2D

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

destroy

()

Inherited from BaseComponent2D:

Method called when the component is destroyed

disable

()

Inherited from BaseComponent2D:

Disables the component

drawAngle

(
  • ctx
  • translation
  • zoom
)

Draws the angle between the two parent walls of a point.

Parameters:

enable

()

Inherited from BaseComponent2D:

Enables the component

getTargeted

(
  • vector
)
Object

Inherited from BaseComponent2D:

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:

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

onContextChanged

(
  • context
)

Inherited from BaseComponent2D:

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

Parameters:

  • context String
    The new context

onDoubleClick

(
  • event
  • target
  • mstate
  • data
)

Called when the mouse double clicks on a point.

Parameters:

  • event Event

    The JS event.

  • target PointStructure

    The point structure dragged by the mouse.

  • mstate Object

    The state of the mouse.

  • data Object

    Data used for drawing. Can be null or something else if you wish to override the function.

onDragEnd

(
  • event
  • target
  • mstate
  • data
)

Called when the mouse releases the point.

Parameters:

  • event Event

    The JS event.

  • target PointStructure

    The point structure dragged by the mouse.

  • mstate Object

    The state of the mouse.

  • data Object

    Data used for drawing. Can be null or something else if you wish to override the function.

onDragging

(
  • event
  • target
  • mstate
  • data
)

Called when the mouse is dragging the point.

Parameters:

  • event Event

    The JS event.

  • target PointStructure

    The point structure dragged by the mouse.

  • mstate Object

    The state of the mouse.

  • data Object

    Data used for drawing. Can be null or something else if you wish to override the function.

onDragStart

(
  • event
  • target
  • mstate
  • data
)

Called when the mouse starts dragging a point.

Parameters:

  • event Event

    The JS event.

  • target PointStructure

    The point structure dragged by the mouse.

  • mstate Object

    The state of the mouse.

  • data Object

    Data used for drawing. Can be null or something else if you wish to override the function.

onHover

(
  • event
  • target
  • mstate
  • data
)

Called when the mouse hovers over a point.

Parameters:

  • event Event

    The JS event.

  • target PointStructure

    The point structure dragged by the mouse.

  • mstate Object

    The state of the mouse.

  • data Object

    Data used for drawing. Can be null or something else if you wish to override the function.

onLeave

(
  • event
  • target
  • mstate
  • data
)

Called when the mouse leaves the point.

Parameters:

  • event Event

    The JS event.

  • target PointStructure

    The point structure dragged by the mouse.

  • mstate Object

    The state of the mouse.

  • data Object

    Data used for drawing. Can be null or something else if you wish to override the function.

startListening

()

Inherited from BaseComponent2D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent2D:

Removes all the event listeners.

tryMergeAttachAll

(
  • [force]
)

Processes all points which have the needsUpdate flag set to true. This method tries to merge points or attach them to surrounding walls.

Parameters:

  • [force] Boolean optional

    Forces the update of all points.

update

()

Inherited from BaseComponent2D:

Generic update method, called on every frame

Properties

_ANGLERADIUS

Number

Radius of the angle when drawn on the 2D canvas.

Default: 55

_SIZE

Number

Size of the points when drawn on the 2D canvas.

Default: 13

anglePointList

PointStructure[]

Which points need their angle to be displayed.

dragging

Boolean private

Flag that indicates if a point is currently dragged.

name

String

Inherited from BaseComponent2D:

Component name

priority

Number private

Inherited from BaseComponent2D

Priority of the component for update callbacks.

Default: 90

structure

wnp.Structure

Inherited from BaseComponent2D:

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