API Docs for: 2.7.3
Show:

OvertureComponent2D Class

Extends BaseComponent2D
Module: Component
Parent Module: Wanaplan

Overture component 2D.

Constructor

OvertureComponent2D

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

_drawOverture

(
  • ctx
  • translation
  • zoom
  • data
)
private

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

()

Checks that overtures are well parented with their parent wall.

destroy

()

Inherited from BaseComponent2D:

Method called when the component is destroyed

disable

()

Inherited from BaseComponent2D:

Disables the component

enable

()

Inherited from BaseComponent2D:

Enables the component

getTargeted

(
  • vector
)
Object

Inherited from BaseComponent2D

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

Initializes the overture menu.

onAddOverture

(
  • event
)

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

Parameters:

  • event Event

    The event received with the basic overture parameters.

onAddOvertureDragStart

(
  • event
  • target
  • mstate
  • data
)

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

(
  • event
  • target
  • mstate
  • data
)

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

(
  • event
  • data
)

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

(
  • event
  • target
  • mstate
  • data
)

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

(
  • context
)

Inherited from BaseComponent2D:

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

Parameters:

  • context String
    The new context

onContextMenu

(
  • event
  • target
  • mstate
  • data
)

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

(
  • event
  • property
  • value
)

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

Parameters:

onContextMenuRemove

(
  • target
)

Called when the user removes the context menu.

Parameters:

onDoubleClick

(
  • event
  • target
  • mstate
  • data
)

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

(
  • event
  • target
  • mstate
  • data
)

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

(
  • event
  • target
  • mstate
  • data
)
Boolean

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

(
  • event
  • target
  • mstate
  • data
)
Boolean

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

(
  • event
  • target
  • mstate
  • data
)
Boolean

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

(
  • event
  • target
  • mstate
  • data
)

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

(
  • event
  • target
  • mstate
  • data
)

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

(
  • ctx
  • translation
  • zoom
  • data
)
private

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

(
  • ctx
  • translation
  • zoom
  • data
)
private

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:

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

name

String

Inherited from BaseComponent2D:

Component name

priority

Number

Inherited from BaseComponent2D:

Priority of the component in the "update" and "draw" routines

structure

wnp.Structure

Inherited from BaseComponent2D:

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

Events

wnp.engine2d.onAddOverture

Fired when the action to add an overture is started.

wnp.engine2d.onAddOvertureEnd

Fired when the action to add an overture is done.

wnp.menu.main.add

Fired to add a menu item into the main menu.

wnp.menu.main.deselect

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