WanaPlan

API Docs for: 2.7.0
Show:

WallComponent2D

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Summary

2D Wall management.

Constructor

WallComponent2D

Syntax

WallComponent2D

()

Summary

Methods

_addWallFirstPoint

Syntax

_addWallFirstPoint

(
  • mstate
  • [point]
)
private

Summary

Adds a the first point in the wall.

Parameters:

_addWallUpdate.

Syntax

_addWallUpdate.

(
  • mstate
)
private

Summary

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

Parameters:

  • mstate Object

    State of the mouse.

_addWallUpdate.

Syntax

_addWallUpdate.

(
  • mstate
)
private

Summary

Updates the wall temporary.

Parameters:

  • mstate Object

    The state of the mouse.

_drawMeasures

Syntax

_drawMeasures

(
  • ctx
  • translation
  • zoom
)
private

Summary

Draws all measures.

Parameters:

  • ctx CanvasRenderingContext2D

    Canvas 2D context.

  • translation BABYLON.Vector2

    Canvas 2D translation.

  • zoom Number

    Canvas 2D zoom.

destroy

Inherited from BaseComponent2D:

Syntax

destroy

()

Summary

Method called when the component is destroyed

disable

Inherited from BaseComponent2D:

Syntax

disable

()

Summary

Disables the component

drawWall

Syntax

drawWall

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

Summary

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:

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

simplifyWalls

Syntax

simplifyWalls

() private

Summary

Deletes small walls.

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

_COLORS

Syntax

_COLORS

Array final static

Summary

Constants for the colors of the wall.

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

_PATTERN_IMGS

Syntax

_PATTERN_IMGS

Image

Summary

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

Syntax

_PATTERNS

CtxPattern

Summary

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

Syntax

displayMesure

Boolean

Summary

Flag that enables/disables the displaying of measures.

Default: true

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: 10

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

TYPE_GARDEN

Syntax

TYPE_GARDEN

Number private final static

Summary

Constant for garden walls.

TYPE_NORMAL

Syntax

TYPE_NORMAL

Number private final static

Summary

Constant for normal wall.

TYPE_SEPARATOR

Syntax

TYPE_SEPARATOR

Number private final static

Summary

Constant for separator walls.

TYPE_TERRACE

Syntax

TYPE_TERRACE

Number private final static

Summary

Constant for terrace walls.