new Mouse(element)
Provides cross-browser mouse events for a given element. The events of
the given element are automatically populated with handlers that translate
mouse events into a non-browser-specific event provided by the
Guacamole.Mouse instance.
Parameters:
Name | Type | Description |
---|---|---|
element |
Element | The Element to use to provide mouse events. |
Classes
Members
currentState :Guacamole.Mouse.State
The current mouse state. The properties of this state are updated when
mouse events fire. This state object is also passed in as a parameter to
the handler of any mouse events.
Type:
PIXELS_PER_LINE
The number of pixels to scroll per line.
PIXELS_PER_PAGE
The number of pixels to scroll per page.
scrollThreshold
The minimum amount of pixels scrolled required for a single scroll button
click.
touchMouseThreshold
The number of mousemove events to require before re-enabling mouse
event handling after receiving a touch event.
Methods
setCursor(canvas, x, y) → {Boolean}
Changes the local mouse cursor to the given canvas, having the given
hotspot coordinates. This affects styling of the element backing this
Guacamole.Mouse only, and may fail depending on browser support for
setting the mouse cursor.
If setting the local cursor is desired, it is up to the implementation
to do something else, such as use the software cursor built into
Guacamole.Display, if the local cursor cannot be set.
Parameters:
Name | Type | Description |
---|---|---|
canvas |
HTMLCanvasElement | The cursor image. |
x |
Number | The X-coordinate of the cursor hotspot. |
y |
Number | The Y-coordinate of the cursor hotspot. |
Returns:
true if the cursor was successfully set, false if the
cursor could not be set for any reason.
- Type
- Boolean
Events
onmousedown
Fired whenever the user presses a mouse button down over the element
associated with this Guacamole.Mouse.
Parameters:
Name | Type | Description |
---|---|---|
state |
Guacamole.Mouse.State | The current mouse state. |
onmousemove
Fired whenever the user moves the mouse over the element associated with
this Guacamole.Mouse.
Parameters:
Name | Type | Description |
---|---|---|
state |
Guacamole.Mouse.State | The current mouse state. |
onmouseout
Fired whenever the mouse leaves the boundaries of the element associated
with this Guacamole.Mouse.
onmouseup
Fired whenever the user releases a mouse button down over the element
associated with this Guacamole.Mouse.
Parameters:
Name | Type | Description |
---|---|---|
state |
Guacamole.Mouse.State | The current mouse state. |