WanaPlan

API Docs for: 2.7.0
Show:

OvertureComponent2D

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Summary

Overture component 2D.

Constructor

OvertureComponent2D

Syntax

OvertureComponent2D

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

_drawOverture

Syntax

_drawOverture

(
  • ctx
  • translation
  • zoom
  • data
)
private

Summary

Draws an overture.

Parameters:

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • translation BABYLON.Vector2

    The translation on the canvas.

  • zoom Number

    The current zoom of the canvas.

  • data Object

    Important data used for drawing (null).

compute

Syntax

compute

()

Summary

Checks that overtures are well parented with their parent wall.

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

Tests if the cursor is on one of the overtures element, and if so returns it.

Parameters:

  • vector BABYLON.Vector2

    The vector representing the coordinates of the cursor.

Returns:

Object:

The target or null if nothing is under the cursor.

initialize

Inherited from BaseComponent2D

Syntax

initialize

()

Summary

Initializes the overture menu.

onAddOverture

Syntax

onAddOverture

(
  • event
)

Summary

Adds an overture. Triggered on event wnp.engine2d.onAddOverture

Parameters:

  • event Event

    The event received with the basic overture parameters.

onAddOvertureDragStart

Syntax

onAddOvertureDragStart

(
  • event
  • target
  • mstate
  • data
)

Summary

Called when dragging an added overture.

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

onAddOvertureEnd

Syntax

onAddOvertureEnd

(
  • event
  • target
  • mstate
  • data
)

Summary

Called when the action to add an overture is done. Triggered on wnp.engine2d.onAddOvertureEnd

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

onAddOvertureLeaveZone

Syntax

onAddOvertureLeaveZone

(
  • event
  • data
)

Summary

Unregisters the pointer events when the action to add an overture is done and the cursor leaves the zone.

Parameters:

  • event Event

    The event caught.

  • data Object

    Important data used for drawing.

onAddOvertureUpdate

Syntax

onAddOvertureUpdate

(
  • event
  • target
  • mstate
  • data
)

Summary

Called when updating an added overture.

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

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

onContextMenu

Syntax

onContextMenu

(
  • event
  • target
  • mstate
  • data
)

Summary

Handles all the items of the context menu. Triggered on event OvertureComponent2D.context-menu

Parameters:

  • event Event

    The event caught.

  • target OvertureStructure

    The overture structure hovered by the mouse.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing (null).

onContextMenuPropertyChanged

Syntax

onContextMenuPropertyChanged

(
  • event
  • property
  • value
)

Summary

Called when the value of a context menu property is changed.

Parameters:

  • event Event

    The event caught.

  • property String

    The property that changed.

  • value Number | String

    The new value.

onContextMenuRemove

Syntax

onContextMenuRemove

(
  • target
)

Summary

Called when the user removes the context menu.

Parameters:

onDoubleClick

Syntax

onDoubleClick

(
  • event
  • target
  • mstate
  • data
)

Summary

Duplicates an overture on double click. Triggered on event OvertureComponent2D.double-click

Parameters:

  • event Event

    The event caught.

  • target wnp.overtureStructure

    The overture selected.

  • mstate Object

    The current state of the pointer.

  • data Object

    Data.

onDragEnd

Syntax

onDragEnd

(
  • event
  • target
  • mstate
  • data
)

Summary

When the dragging ends.

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

onDraggingMove

Syntax

onDraggingMove

(
  • event
  • target
  • mstate
  • data
)
Boolean

Summary

When an overture is moved by dragging the cursor.

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

Returns:

Boolean:

false

onDraggingResize

Syntax

onDraggingResize

(
  • event
  • target
  • mstate
  • data
)
Boolean

Summary

When an overture is resized by dragging the cursor.

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

Returns:

Boolean:

false

onDragStart

Syntax

onDragStart

(
  • event
  • target
  • mstate
  • data
)
Boolean

Summary

Handles the movement and reshaping of the overture. Triggered on event OvertureComponent2D.drag-start

Parameters:

  • event Event

    The event caught.

  • target OvertureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

Returns:

Boolean:

false

onHover

Syntax

onHover

(
  • event
  • target
  • mstate
  • data
)

Summary

When an overture is hovered by the mouse. Triggered on event OvertureComponent2D.hover

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

onLeave

Syntax

onLeave

(
  • event
  • target
  • mstate
  • data
)

Summary

When an overture is leaved by the mouse. Triggered on event OvertureComponent2D.leave

Parameters:

  • event Event

    The event caught.

  • target BABYLON.overtureStructure

    The overture structure dragged.

  • mstate Object

    The current state of the pointer.

  • data Object

    Important data used for drawing.

onSelectionDynamicDraw

Syntax

onSelectionDynamicDraw

(
  • ctx
  • translation
  • zoom
  • data
)
private

Summary

Dynamic draw.

Parameters:

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • translation BABYLON.Vector2

    The translation on the canvas.

  • zoom Number

    The current zoom of the canvas.

  • data Object

    Important data used for drawing (null).

onStaticDraw

Syntax

onStaticDraw

(
  • ctx
  • translation
  • zoom
  • data
)
private

Summary

Static draw.

Parameters:

  • ctx CanvasRenderingContext2D

    Context 2D of the canvas.

  • translation BABYLON.Vector2

    The translation on the canvas.

  • zoom Number

    The current zoom of the canvas.

  • data Object

    Important data used for drawing (null).

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

Events

wnp.engine2d.onAddOverture

Syntax

wnp.engine2d.onAddOverture

Summary

Fired when the action to add an overture is started.

wnp.engine2d.onAddOvertureEnd

Syntax

wnp.engine2d.onAddOvertureEnd

Summary

Fired when the action to add an overture is done.

wnp.menu.main.add

Syntax

wnp.menu.main.add

Summary

Fired to add a menu item into the main menu.

wnp.menu.main.deselect

Syntax

wnp.menu.main.deselect

Summary

Fired when an item from main menu needs to be deselected.