API Docs for: 2.7.3
Show:

WallComponent2D Class

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

2D Wall management.

Constructor

WallComponent2D

()

Methods

_addWallFirstPoint

(
  • mstate
  • [point]
)
private

Adds a the first point in the wall.

Parameters:

_addWallUpdate.

(
  • mstate
)
private

Add the second point and insert the wall in the structure.

Parameters:

  • mstate Object

    State of the mouse.

_addWallUpdate.

(
  • mstate
)
private

Updates the wall temporary.

Parameters:

  • mstate Object

    The state of the mouse.

_drawMeasures

(
  • ctx
  • translation
  • zoom
)
private

Draws all measures.

Parameters:

destroy

()

Inherited from BaseComponent2D:

Method called when the component is destroyed

disable

()

Inherited from BaseComponent2D:

Disables the component

drawWall

(
  • ctx
  • translation
  • zoom
  • wall
  • [options]
)

Draws a wall.

Parameters:

  • ctx CanvasRenderingContext2D

    Canvas 2D context.

  • translation BABYLON.Vector2

    Canvas 2D translation.

  • zoom Number

    Canvas 2D zoom.

  • wall WallStructure

    Involved wall.

  • [options] Object optional

    Drawing options.

    • [measureDisplayed=true] Object optional

      Shows or hides the measure.

    • [styleId] Object optional

      Changes the drawing style.

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

simplifyWalls

() private

Deletes small walls.

startListening

()

Inherited from BaseComponent2D:

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent2D:

Removes all the event listeners.

update

()

Inherited from BaseComponent2D:

Generic update method, called on every frame

Properties

_COLORS

Array final static

Constants for the colors of the wall.

Default: ["#333333", "#616161", "#BEBEBE", "#EEEEEE", "#339900"]

_PATTERN_IMGS

Image

Images for drawing style of the walls. This is an array of Image. You can then change the style of the wall in the function drawWall using options.styleId where styleId is the index of the style in this Array.

_PATTERNS

CtxPattern

Drawing patterns for drawing style of the walls. This is an array of drawing patterns (see canvas patterns). You can then change the style of the wall in the function drawWall using options.styleId where styleId is the index of the style in this Array.

NB : use function createPattern of a 2D context. For the Image parameter, use the image in PATTERN_IMGS at the same index.

Default: "repeat"

displayMesure

Boolean

Flag that enables/disables the displaying of measures.

Default: true

name

String

Inherited from BaseComponent2D:

Component name

priority

Number private

Inherited from BaseComponent2D

Priority of the component for update callbacks.

Default: 10

structure

wnp.Structure

Inherited from BaseComponent2D:

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

TYPE_GARDEN

Number private final static

Constant for garden walls.

TYPE_NORMAL

Number private final static

Constant for normal wall.

TYPE_SEPARATOR

Number private final static

Constant for separator walls.

TYPE_TERRACE

Number private final static

Constant for terrace walls.