WanaPlan

API Docs for: 2.7.0
Show:

PointComponent2D

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Summary

Class managing the 2D wall points.

Constructor

PointComponent2D

Syntax

PointComponent2D

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

destroy

Inherited from BaseComponent2D:

Syntax

destroy

()

Summary

Method called when the component is destroyed

disable

Inherited from BaseComponent2D:

Syntax

disable

()

Summary

Disables the component

drawAngle

Syntax

drawAngle

(
  • ctx
  • translation
  • zoom
)

Summary

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

Parameters:

  • ctx CanvasRenderingContext2D

    2D canvas context.

  • translation BABYLON.vector2

    The canvas translation.

  • zoom Number

    The canvas zoom.

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

onDoubleClick

Syntax

onDoubleClick

(
  • event
  • target
  • mstate
  • data
)

Summary

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

Syntax

onDragEnd

(
  • event
  • target
  • mstate
  • data
)

Summary

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

Syntax

onDragging

(
  • event
  • target
  • mstate
  • data
)

Summary

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

Syntax

onDragStart

(
  • event
  • target
  • mstate
  • data
)

Summary

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

Syntax

onHover

(
  • event
  • target
  • mstate
  • data
)

Summary

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

Syntax

onLeave

(
  • event
  • target
  • mstate
  • data
)

Summary

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:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent2D:

Syntax

stopListening

()

Summary

Removes all the event listeners.

tryMergeAttachAll

Syntax

tryMergeAttachAll

(
  • [force]
)

Summary

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:

Syntax

update

()

Summary

Generic update method, called on every frame

Properties

_ANGLERADIUS

Syntax

_ANGLERADIUS

Number

Summary

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

Default: 55

_SIZE

Syntax

_SIZE

Number

Summary

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

Default: 13

anglePointList

Syntax

anglePointList

PointStructure[]

Summary

Which points need their angle to be displayed.

dragging

Syntax

dragging

Boolean private

Summary

Flag that indicates if a point is currently dragged.

name

Inherited from BaseComponent2D:

Syntax

name

String

Summary

Component name

priority

Inherited from BaseComponent2D

Syntax

priority

Number private

Summary

Priority of the component for update callbacks.

Default: 90

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