API Docs for: 2.7.3
Show:

wnp.PointerManager Class

Module: Input
Parent Module: Wanaplan

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

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

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

(
  • event
)
Number private

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

(
  • event
)
Number private

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

(
  • event
)
Number private

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

(
  • event
)
private

Notifies the callback that an event has been caught.

Parameters:

  • event Event

    An event object.

_updateMouseState

(
  • pEvent
  • [additionalAction]
)
private

Updates the pointer state.

Parameters:

  • pEvent Event

    An event object.

  • [additionalAction] Number optional

    Additional actions to add to mask.

addMouseSupport

()

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

addTouchSupport

()

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

getStatus

() Object

Gets the current state of the manager;

Returns:

Object:

Returns an object that contains all states of the manager.

onMouseDoubleClick

(
  • event
)
private

Handler called when a double click event is caught.

Parameters:

  • event Event

    An event object.

onMouseDown

(
  • event
)
private

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

Parameters:

  • event Event

    An event object.

onMouseMove

(
  • event
)
private

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

Parameters:

  • event Event

    An event object.

onMouseUp

(
  • event
)
private

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

Parameters:

  • event Event

    An event object.

onMouseWheel

(
  • event
)
private

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

()

Removes mouse support

removeTouchSupport

()

Removes touch support.

reset

()

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

resize

(
  • [width]
  • [height]
)

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

(
  • domElement
)

Sets the DOM element to use for event listening.

Parameters:

Properties

actions

Number

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

Number

The currently pressed button.

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

buttons

Number

Number that represents current modifiers (masks).

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

pos

BABYLON.Vector2

The cursor position on the canvas.

posDelta

BABYLON.Vector2

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

Events

wnp.input.pointerchanged

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

Event Payload:

  • inputStatus Object

    an object containing all states of the pointer manager