WanaPlan

API Docs for: 2.7.0
Show:

wnp.PointerManager

Module: Input
Parent Module: Wanaplan

Summary

The pointer manager is an abstraction of MouseEvent, TouchEvent and PointerEvent and is responsible for managing all types of 'pointer' input in Wanaplan.

Constructor

wnp.PointerManager

Syntax

wnp.PointerManager

(
  • core
  • callback
  • domElement
  • [param]
)

Summary

Parameters:

  • core Core

    The main engine.

  • callback Function

    Function called when an event is caught (can be null).

  • domElement HTMLElement

    The DOM element to use for event listening.

  • [param] Object optional

    Additional parameters { offsets: BABYLON.Vector3(0,0), width: 0, height: 0 }.

Methods

_getButton

Syntax

_getButton

(
  • event
)
Number private

Summary

Gets the button of the mouse responsible for the event (left for touch devices).

Parameters:

  • event Event

    An event object.

Returns:

Number:

The mouse button.

_getX

Syntax

_getX

(
  • event
)
Number private

Summary

Gets the position of the cursor on X axis.

Parameters:

  • event Event

    An event object.

Returns:

Number:

The position of the cursor on X axis.

_getY

Syntax

_getY

(
  • event
)
Number private

Summary

Gets the position of the cursor on Y axis.

Parameters:

  • event Event

    An event object.

Returns:

Number:

The position of the cursor on Y axis.

_notifyCb

Syntax

_notifyCb

(
  • event
)
private

Summary

Notifies the callback that an event has been caught.

Parameters:

  • event Event

    An event object.

_updateMouseState

Syntax

_updateMouseState

(
  • pEvent
  • [additionalAction]
)
private

Summary

Updates the pointer state.

Parameters:

  • pEvent Event

    An event object.

  • [additionalAction] Number optional

    Additional actions to add to mask.

addMouseSupport

Syntax

addMouseSupport

()

Summary

Adds mouse support for standard browsers or Internet Explorer 10 and 11.

addTouchSupport

Syntax

addTouchSupport

()

Summary

Adds touch support for standard browsers or Internet Explorer 10 and 11.

getStatus

Syntax

getStatus

() Object

Summary

Gets the current state of the manager;

Returns:

Object:

Returns an object that contains all states of the manager.

onMouseDoubleClick

Syntax

onMouseDoubleClick

(
  • event
)
private

Summary

Handler called when a double click event is caught.

Parameters:

  • event Event

    An event object.

onMouseDown

Syntax

onMouseDown

(
  • event
)
private

Summary

Handler called when a (mouse/touch/pointer) down event is caught.

Parameters:

  • event Event

    An event object.

onMouseMove

Syntax

onMouseMove

(
  • event
)
private

Summary

Handler called when a (mouse/touch/pointer) move event is caught.

Parameters:

  • event Event

    An event object.

onMouseUp

Syntax

onMouseUp

(
  • event
)
private

Summary

Handler called when a (mouse/touch/pointer) up event is caught.

Parameters:

  • event Event

    An event object.

onMouseWheel

Syntax

onMouseWheel

(
  • event
)
private

Summary

Handler called when a mouse wheel event is caught. The value is normalized to be usable in Wanaplan.

Parameters:

  • event Event

    An event object.

removeMouseSupport

Syntax

removeMouseSupport

()

Summary

Removes mouse support

removeTouchSupport

Syntax

removeTouchSupport

()

Summary

Removes touch support.

reset

Syntax

reset

()

Summary

Forces the exit of the state stateful (ex: "dragging") NB : Out events will be not raised (ex "drag-end").

resize

Syntax

resize

(
  • [width]
  • [height]
)

Summary

Called when the viewport size has changed. If no parameters are passed to the function then the size is computed from the DOM element where events are listened to.

Parameters:

  • [width] Number optional

    New width.

  • [height] Number optional

    New height.

setDomElement

Syntax

setDomElement

(
  • domElement
)

Summary

Sets the DOM element to use for event listening.

Parameters:

Properties

actions

Syntax

actions

Number

Summary

Number that represents current actions (masks).

  • PointerManager.ACTION_CLICK = 1
  • PointerManager.ACTION_DBLCLICK = 2
  • PointerManager.ACTION_DRAGSTART = 4
  • PointerManager.ACTION_DRAGGING = 8
  • PointerManager.ACTION_DRAGEND = 16
  • PointerManager.ACTION_SCROLLUP = 32
  • PointerManager.ACTION_SCROLLDOWN = 64

buttons

Syntax

buttons

Number

Summary

The currently pressed button.

  • PointerManager.BUTTON_LEFT = 1
  • PointerManager.BUTTON_MIDDLE = 2
  • PointerManager.BUTTON_RIGHT = 4

buttons

Syntax

buttons

Number

Summary

Number that represents current modifiers (masks).

  • PointerManager.MODIFIER_ALT = 1
  • PointerManager.MODIFIER_CTRL = 2
  • PointerManager.MODIFIER_SHIFT = 4

pos

Syntax

pos

BABYLON.Vector2

Summary

The cursor position on the canvas.

posDelta

Syntax

posDelta

BABYLON.Vector2

Summary

The delta position of the cursor (difference between last and current positions).

Events

wnp.input.pointerchanged

Syntax

wnp.input.pointerchanged

Summary

Fired when an input has been detected (click, touch, etc.).

Event Payload:

  • inputStatus Object

    an object containing all states of the pointer manager