Class: Target

Guacamole.Mouse.Event.Target()

new Target()

An object which can dispatch Guacamole.Mouse.Event objects representing mouse events. These mouse events may be produced from an actual mouse device (as with Guacamole.Mouse), from an emulated mouse device (as with Guacamole.Mouse.Touchpad, or may be programmatically generated (using functions like dispatch(), press(), and release()).
Source:

Extends

Members

(non-null) 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:
Source:

Methods

click(buttonnon-null, eventsopt)

Clicks (presses and releases) the given mouse button. Valid button names are defined by Guacamole.Mouse.State.Buttons and correspond to the button-related properties of Guacamole.Mouse.State.
Parameters:
Name Type Attributes Default Description
button string The name of the mouse button to click, as defined by Guacamole.Mouse.State.Buttons.
events Event | Array.<Event> <optional>
[] The DOM events related to the click, if any.
Source:
Fires:

dispatch(eventnon-null)

Dispatches the given event, invoking all event handlers registered with this Guacamole.Event.Target for that event's type.
Parameters:
Name Type Description
event Guacamole.Event The event to dispatch.
Inherited From:
Source:

move(positionnon-null, eventsopt)

Moves the mouse to the given coordinates.
Parameters:
Name Type Attributes Default Description
position Guacamole.Position | object The new coordinates of the mouse pointer. This object may be a Guacamole.Position or any object with "x" and "y" properties.
events Event | Array.<Event> <optional>
[] The DOM events related to the mouse movement, if any.
Source:
Fires:

off(typenon-null, listenernon-null) → (non-null) {boolean}

Unregisters a listener that was previously registered with on() or onEach(). If no such listener was registered, this function has no effect. If multiple copies of the same listener were registered, the first listener still registered will be removed.
Parameters:
Name Type Description
type string The unique name of the event type handled by the listener being removed.
listener Guacamole.Event.Target~listener The listener function previously provided to on()or onEach().
Inherited From:
Source:
Returns:
true if the specified listener was removed, false otherwise.
Type
boolean

offEach(typesnon-null, listenernon-null) → (non-null) {boolean}

Unregisters listeners that were previously registered with on() or onEach(). If no such listeners were registered, this function has no effect. If multiple copies of the same listener were registered for the same event type, the first listener still registered will be removed.

Invoking this function is equivalent to manually invoking off() for each of the provided types.

Parameters:
Name Type Description
types Array.<string> The unique names of the event types handled by the listeners being removed.
listener Guacamole.Event.Target~listener The listener function previously provided to on() or onEach().
Inherited From:
Source:
Returns:
true if any of the specified listeners were removed, false otherwise.
Type
boolean

on(typenon-null, listenernon-null)

Registers a listener for events having the given type, as dictated by the type property of Guacamole.Event provided to dispatch().
Parameters:
Name Type Description
type string The unique name of this event type.
listener Guacamole.Event.Target~listener The function to invoke when an event having the given type is dispatched. The Guacamole.Event object provided to dispatch() will be passed to this function, along with the dispatching Guacamole.Event.Target.
Inherited From:
Source:

onEach(typesnon-null, listenernon-null)

Registers a listener for events having the given types, as dictated by the type property of Guacamole.Event provided to dispatch().

Invoking this function is equivalent to manually invoking on() for each of the provided types.

Parameters:
Name Type Description
types Array.<string> The unique names of the event types to associate with the given listener.
listener Guacamole.Event.Target~listener The function to invoke when an event having any of the given types is dispatched. The Guacamole.Event object provided to dispatch() will be passed to this function, along with the dispatching Guacamole.Event.Target.
Inherited From:
Source:

out(eventsopt)

Notifies event listeners that the mouse pointer has left the boundaries of the area being monitored for mouse events.
Parameters:
Name Type Attributes Default Description
events Event | Array.<Event> <optional>
[] The DOM events related to the mouse leaving the boundaries of the monitored object, if any.
Source:
Fires:

press(buttonnon-null, eventsopt)

Presses the given mouse button, if it isn't already pressed. Valid button names are defined by Guacamole.Mouse.State.Buttons and correspond to the button-related properties of Guacamole.Mouse.State.
Parameters:
Name Type Attributes Default Description
button string The name of the mouse button to press, as defined by Guacamole.Mouse.State.Buttons.
events Event | Array.<Event> <optional>
[] The DOM events that are related to the mouse button press, if any.
Source:
Fires:

release(buttonnon-null, eventsopt)

Releases the given mouse button, if it isn't already released. Valid button names are defined by Guacamole.Mouse.State.Buttons and correspond to the button-related properties of Guacamole.Mouse.State.
Parameters:
Name Type Attributes Default Description
button string The name of the mouse button to release, as defined by Guacamole.Mouse.State.Buttons.
events Event | Array.<Event> <optional>
[] The DOM events related to the mouse button release, if any.
Source:
Fires:

reset(eventsopt)

Releases all mouse buttons that are currently pressed. If all mouse buttons have already been released, this function has no effect.
Parameters:
Name Type Attributes Default Description
events Event | Array.<Event> <optional>
[] The DOM event related to all mouse buttons being released, if any.
Source:
Fires:

Events

mousedown

Fired whenever a mouse button is effectively pressed. Depending on the object dispatching the event, this can be due to a true mouse button press (Guacamole.Mouse), an emulated mouse button press from a touch gesture (Guacamole.Mouse.Touchpad and Guacamole.Mouse.Touchscreen), or may be programmatically generated through dispatch(), press(), or click().
Parameters:
Name Type Description
event Guacamole.Mouse.Event The mousedown event that was fired.
Source:

mousemove

Fired whenever the mouse pointer is effectively moved. Depending on the object dispatching the event, this can be due to true mouse movement (Guacamole.Mouse), emulated mouse movement from a touch gesture (Guacamole.Mouse.Touchpad and Guacamole.Mouse.Touchscreen), or may be programmatically generated through dispatch(), or move().
Parameters:
Name Type Description
event Guacamole.Mouse.Event The mousemove event that was fired.
Source:

mouseout

Fired whenever the mouse pointer leaves the boundaries of the element being monitored for interaction. This will only ever be automatically fired due to movement of an actual mouse device via Guacamole.Mouse unless programmatically generated through dispatch(), or out().
Parameters:
Name Type Description
event Guacamole.Mouse.Event The mouseout event that was fired.
Source:

mouseup

Fired whenever a mouse button is effectively released. Depending on the object dispatching the event, this can be due to a true mouse button release (Guacamole.Mouse), an emulated mouse button release from a touch gesture (Guacamole.Mouse.Touchpad and Guacamole.Mouse.Touchscreen), or may be programmatically generated through dispatch(), release(), or click().
Parameters:
Name Type Description
event Guacamole.Mouse.Event The mouseup event that was fired.
Source: