wnp.PointerManager
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
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
Syntax
Summary
Gets the button of the mouse responsible for the event (left for touch devices).
Parameters:
-
event
EventAn event object.
Returns:
The mouse button.
_getX
Syntax
Summary
Gets the position of the cursor on X axis.
Parameters:
-
event
EventAn event object.
Returns:
The position of the cursor on X axis.
_getY
Syntax
Summary
Gets the position of the cursor on Y axis.
Parameters:
-
event
EventAn event object.
Returns:
The position of the cursor on Y axis.
_notifyCb
Syntax
_notifyCb
-
event
Summary
Notifies the callback that an event has been caught.
Parameters:
-
event
EventAn event object.
_updateMouseState
Syntax
_updateMouseState
-
pEvent
-
[additionalAction]
Summary
Updates the pointer state.
Parameters:
-
pEvent
EventAn event object.
-
[additionalAction]
Number optionalAdditional 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
Summary
Gets the current state of the manager;
Returns:
Returns an object that contains all states of the manager.
onMouseDoubleClick
Syntax
onMouseDoubleClick
-
event
Summary
Handler called when a double click event is caught.
Parameters:
-
event
EventAn event object.
onMouseDown
Syntax
onMouseDown
-
event
Summary
Handler called when a (mouse/touch/pointer) down event is caught.
Parameters:
-
event
EventAn event object.
onMouseMove
Syntax
onMouseMove
-
event
Summary
Handler called when a (mouse/touch/pointer) move event is caught.
Parameters:
-
event
EventAn event object.
onMouseUp
Syntax
onMouseUp
-
event
Summary
Handler called when a (mouse/touch/pointer) up event is caught.
Parameters:
-
event
EventAn event object.
onMouseWheel
Syntax
onMouseWheel
-
event
Summary
Handler called when a mouse wheel event is caught. The value is normalized to be usable in Wanaplan.
Parameters:
-
event
EventAn 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.
setDomElement
Syntax
setDomElement
-
domElement
Summary
Sets the DOM element to use for event listening.
Parameters:
-
domElement
HTMLElementThe DOM element to use.
Properties
actions
Syntax
actions
Number
Summary
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
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
Objectan object containing all states of the pointer manager