Class Guacamole.Mouse
Defined in: Mouse.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Guacamole.Mouse(element)
Provides cross-browser mouse events for a given element.
|
Field Attributes | Field Name and Description |
---|---|
The current mouse state.
|
|
The number of pixels to scroll per line.
|
|
The number of pixels to scroll per page.
|
|
<inner> |
Cumulative scroll delta amount.
|
The minimum amount of pixels scrolled required for a single scroll button
click.
|
|
The number of mousemove events to require before re-enabling mouse
event handling after receiving a touch event.
|
Method Attributes | Method Name and Description |
---|---|
setCursor(canvas, x, y)
Changes the local mouse cursor to the given canvas, having the given
hotspot coordinates.
|
Event Attributes | Event Name and Description |
---|---|
onmousedown(state)
Fired whenever the user presses a mouse button down over the element
associated with this Guacamole.Mouse.
|
|
onmousemove(state)
Fired whenever the user moves the mouse over the element associated with
this Guacamole.Mouse.
|
|
Fired whenever the mouse leaves the boundaries of the element associated
with this Guacamole.Mouse.
|
|
onmouseup(state)
Fired whenever the user releases a mouse button down over the element
associated with this Guacamole.Mouse.
|
Class Detail
Guacamole.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:
- {Element} element
- The Element to use to provide mouse events.
Field Detail
{Guacamole.Mouse.State}
currentState
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.
PIXELS_PER_LINE
The number of pixels to scroll per line.
PIXELS_PER_PAGE
The number of pixels to scroll per page.
<inner>
scroll_delta
Cumulative scroll delta amount. This value is accumulated through scroll
events and results in scroll button clicks if it exceeds a certain
threshold.
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.
Method Detail
{Boolean}
setCursor(canvas, x, y)
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:
- {HTMLCanvasElement} canvas
- The cursor image.
- {Number} x
- The X-coordinate of the cursor hotspot.
- {Number} y
- The Y-coordinate of the cursor hotspot.
- Returns:
- {Boolean} true if the cursor was successfully set, false if the cursor could not be set for any reason.
Event Detail
onmousedown(state)
Fired whenever the user presses a mouse button down over the element
associated with this Guacamole.Mouse.
- Parameters:
- {Guacamole.Mouse.State} state
- The current mouse state.
onmousemove(state)
Fired whenever the user moves the mouse over the element associated with
this Guacamole.Mouse.
- Parameters:
- {Guacamole.Mouse.State} state
- The current mouse state.
onmouseout()
Fired whenever the mouse leaves the boundaries of the element associated
with this Guacamole.Mouse.
onmouseup(state)
Fired whenever the user releases a mouse button down over the element
associated with this Guacamole.Mouse.
- Parameters:
- {Guacamole.Mouse.State} state
- The current mouse state.