new CameraEventAggregator
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.
Parameters:
Name | Type | Description |
---|---|---|
canvas |
HTMLCanvasElement | DOC_TBA |
Methods
-
anyButtonDown
-
Gets whether any mouse button is down, a touch has started, or the wheel has been moved.
Returns:
Boolean Whether any mouse button is down, a touch has started, or the wheel has been moved. -
destroy
-
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 a DeveloperError exception. Therefore, assign the return value (undefined
) to the object as done in the example.Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.Returns:
Example
handler = handler && handler.destroy();
-
getButtonPressTime
-
Gets the time the button was pressed or the touch was started.
Parameters:
Name Type Argument Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier <optional>
The keyboard modifier. Returns:
Date The time the button was pressed or the touch was started. -
getButtonReleaseTime
-
Gets the time the button was released or the touch was ended.
Parameters:
Name Type Argument Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier <optional>
The keyboard modifier. Returns:
Date The time the button was released or the touch was ended. -
getLastMovement
-
Gets the start and end position of the last move event (not the aggregated event).
Parameters:
Name Type Argument Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier <optional>
The keyboard modifier. Returns:
Object | undefined An object with two Cartesian2 properties:startPosition
andendPosition
orundefined
. -
getMovement
-
Gets the aggregated start and end position of the current event.
Parameters:
Name Type Argument Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier <optional>
The keyboard modifier. Returns:
-
isButtonDown
-
Gets whether the mouse button is down or a touch has started.
Parameters:
Name Type Argument Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier <optional>
The keyboard modifier. Returns:
Boolean Whether the mouse button is down or a touch has started. -
isDestroyed
-
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 a DeveloperError exception.Returns:
Booleantrue
if this object was destroyed; otherwise,false
. -
isMoving
-
Gets if a mouse button down or touch has started and has been moved.
Parameters:
Name Type Argument Description type
CameraEventType The camera event type. modifier
KeyboardEventModifier <optional>
The keyboard modifier. Returns:
Boolean Returnstrue
if a mouse button down or touch has started and has been moved; otherwise,false