wnp.PointerManager Class
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
CoreThe main engine.
-
callback
FunctionFunction called when an event is caught (can be null).
-
domElement
HTMLElementThe DOM element to use for event listening.
-
[param]
Object optionalAdditional parameters
{ offsets: BABYLON.Vector3(0,0), width: 0, height: 0 }
.
Item Index
Methods
Events
Methods
_getButton
-
event
Gets the button of the mouse responsible for the event (left for touch devices).
Parameters:
-
event
EventAn event object.
Returns:
The mouse button.
_getX
-
event
Gets the position of the cursor on X axis.
Parameters:
-
event
EventAn event object.
Returns:
The position of the cursor on X axis.
_getY
-
event
Gets the position of the cursor on Y axis.
Parameters:
-
event
EventAn event object.
Returns:
The position of the cursor on Y axis.
_notifyCb
-
event
Notifies the callback that an event has been caught.
Parameters:
-
event
EventAn event object.
_updateMouseState
-
pEvent
-
[additionalAction]
Updates the pointer state.
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:
Returns an object that contains all states of the manager.
onMouseDoubleClick
-
event
Handler called when a double click event is caught.
Parameters:
-
event
EventAn event object.
onMouseDown
-
event
Handler called when a (mouse/touch/pointer) down event is caught.
Parameters:
-
event
EventAn event object.
onMouseMove
-
event
Handler called when a (mouse/touch/pointer) move event is caught.
Parameters:
-
event
EventAn event object.
onMouseUp
-
event
Handler called when a (mouse/touch/pointer) up event is caught.
Parameters:
-
event
EventAn event object.
onMouseWheel
-
event
Handler called when a mouse wheel event is caught. The value is normalized to be usable in Wanaplan.
Parameters:
-
event
EventAn 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.
setDomElement
-
domElement
Sets the DOM element to use for event listening.
Parameters:
-
domElement
HTMLElementThe DOM element to use.
Properties
actions
Number
Number that represents current actions (masks).
PointerManager.ACTION_CLICK
= 1PointerManager.ACTION_DBLCLICK
= 2PointerManager.ACTION_DRAGSTART
= 4PointerManager.ACTION_DRAGGING
= 8PointerManager.ACTION_DRAGEND
= 16PointerManager.ACTION_SCROLLUP
= 32PointerManager.ACTION_SCROLLDOWN
= 64
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
Objectan object containing all states of the pointer manager