Class: CameraEventAggregator

CameraEventAggregator

new CameraEventAggregator(elementopt)

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 Attributes Default Description
element Canvas <optional>
document The element to handle events for.
Source:
See:

Members

anyButtonDown :Boolean

Gets whether any mouse button is down, a touch has started, or the wheel has been moved.
Type:
  • Boolean
Source:

currentMousePosition :Cartesian2

Gets the current mouse position.
Type:
Source:

Methods

destroy() → {undefined}

Removes mouse listeners held by this object.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
Source:
See:
Throws:
This object was destroyed, i.e., destroy() was called.
Type
DeveloperError
Returns:
Type
undefined
Example
handler = handler && handler.destroy();

getButtonPressTime(type, modifieropt) → {Date}

Gets the time the button was pressed or the touch was started.
Parameters:
Name Type Attributes Description
type CameraEventType The camera event type.
modifier KeyboardEventModifier <optional>
The keyboard modifier.
Source:
Returns:
The time the button was pressed or the touch was started.
Type
Date

getButtonReleaseTime(type, modifieropt) → {Date}

Gets the time the button was released or the touch was ended.
Parameters:
Name Type Attributes Description
type CameraEventType The camera event type.
modifier KeyboardEventModifier <optional>
The keyboard modifier.
Source:
Returns:
The time the button was released or the touch was ended.
Type
Date

getLastMovement(type, modifieropt) → {Object|undefined}

Gets the start and end position of the last move event (not the aggregated event).
Parameters:
Name Type Attributes Description
type CameraEventType The camera event type.
modifier KeyboardEventModifier <optional>
The keyboard modifier.
Source:
Returns:
An object with two Cartesian2 properties: startPosition and endPosition or undefined.
Type
Object | undefined

getMovement(type, modifieropt) → {Object}

Gets the aggregated start and end position of the current event.
Parameters:
Name Type Attributes Description
type CameraEventType The camera event type.
modifier KeyboardEventModifier <optional>
The keyboard modifier.
Source:
Returns:
An object with two Cartesian2 properties: startPosition and endPosition.
Type
Object

getStartMousePosition(type, modifieropt) → {Cartesian2}

Gets the mouse position that started the aggregation.
Parameters:
Name Type Attributes Description
type CameraEventType The camera event type.
modifier KeyboardEventModifier <optional>
The keyboard modifier.
Source:
Returns:
The mouse position.
Type
Cartesian2

isButtonDown(type, modifieropt) → {Boolean}

Gets whether the mouse button is down or a touch has started.
Parameters:
Name Type Attributes Description
type CameraEventType The camera event type.
modifier KeyboardEventModifier <optional>
The keyboard modifier.
Source:
Returns:
Whether the mouse button is down or a touch has started.
Type
Boolean

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 than isDestroyed will result in a DeveloperError exception.
Source:
See:
Returns:
true if this object was destroyed; otherwise, false.
Type
Boolean

isMoving(type, modifieropt) → {Boolean}

Gets if a mouse button down or touch has started and has been moved.
Parameters:
Name Type Attributes Description
type CameraEventType The camera event type.
modifier KeyboardEventModifier <optional>
The keyboard modifier.
Source:
Returns:
Returns true if a mouse button down or touch has started and has been moved; otherwise, false
Type
Boolean

reset()

Signals that all of the events have been handled and the aggregator should be reset to handle new events.
Source: