Mouse Class
Mouse instance for sync input the mouse should be updated everytime before.
Automatically calculates the diff of position between frames.
The mouse object provided by scripts is automatically updated by the runtime handler.
Item Index
Methods
Properties
Methods
create
()
Create mouse events.
dispose
()
Dispose mouse events.
insideCanvas
()
Boolean
Check if mouse is inside attached canvas (updated async).
Returns:
True if mouse is currently inside the canvas
setCanvas
-
canvas
Element to be used to calculate coordinates relative to that canvas.
Parameters:
-
canvas
ComponentCanvas to be attached to the Mouse instance
setLock
-
value
Set mouse lock, if true mouse lock will be request, if false the mouse will be released.
Parameters:
-
value
BooleanIf true pointer lock will be requested for the canvas attached to the Mouse instance
update
()
Update mouse buttons state, position, wheel and delta synchronously.
updateKey
-
button
-
action
Update a mouse button.
Parameters:
-
button
Number -
action
Number
updatePosition
-
x
-
y
-
xDiff
-
yDiff
Update mouse position.
Parameters:
-
x
Number -
y
Number -
xDiff
Number -
yDiff
Number
Properties
canvas
Element
Canvas attached to this mouse instance used to calculate position and delta in element space coordinates.
delta
Vector2
Mouse movement (coordinates in window space).
domElement
Element
DOM element where to attach the mouse events.
doubleClicked
Array
Indicates a button of the mouse was double clicked.
events
EventManager
Event manager responsible for updating the raw data variables.
Diferent events are used depending on the host platform.
When the update method is called the raw data is reset.
keys
Array
Array with mouse buttons status.
position
Vector2
Mouse position inside of the window (coordinates in window space).
wheel
Number
Mouse scroll wheel movement.