new CameraEventAggregator(element)
Aggregates input events. For example, suppose the following inputs are received between frames:
left mouse button down, mouse move, mouse move, left mouse button up. These events will be aggregated into
one event with a start and end position of the mouse.
Name | Type | Default | Description |
---|---|---|---|
element |
Canvas |
document
|
optional The element to handle events for. |
Methods
-
anyButtonDown() → Boolean
-
Gets whether any mouse button is down, a touch has started, or the wheel has been moved.
Returns:
Whether any mouse button is down, a touch has started, or the wheel has been moved. -
destroy() → undefined
-
Removes mouse listeners held by this object.
Once an object is destroyed, it should not be used; calling any function other thanisDestroyed
will result in aDeveloperError
exception. Therefore, assign the return value (undefined
) to the object as done in the example.Returns:
Throws:
-
DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
handler = handler && handler.destroy();
See:
-
-
getButtonPressTime(type, modifier) → Date
-
Gets the time the button was pressed or the touch was started.
Name Type Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier optional The keyboard modifier. Returns:
The time the button was pressed or the touch was started. -
getButtonReleaseTime(type, modifier) → Date
-
Gets the time the button was released or the touch was ended.
Name Type Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier optional The keyboard modifier. Returns:
The time the button was released or the touch was ended. -
getLastMovement(type, modifier) → Object|undefined
-
Gets the start and end position of the last move event (not the aggregated event).
Name Type Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier optional The keyboard modifier. Returns:
-
getMovement(type, modifier) → Object
-
Gets the aggregated start and end position of the current event.
Name Type Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier optional The keyboard modifier. Returns:
-
isButtonDown(type, modifier) → Boolean
-
Gets whether the mouse button is down or a touch has started.
Name Type Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier optional The keyboard modifier. Returns:
Whether the mouse button is down or a touch has started. -
isDestroyed() → Boolean
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in aDeveloperError
exception.Returns:
true
if this object was destroyed; otherwise,false
. -
isMoving(type, modifier) → Boolean
-
Gets if a mouse button down or touch has started and has been moved.
Name Type Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier optional The keyboard modifier. Returns:
Returnstrue
if a mouse button down or touch has started and has been moved; otherwise,false