CameraEventAggregator

new Cesium.CameraEventAggregator(canvas)

汇总输入事件。例如,假设在帧之间接收到以下输入:按下鼠标左键,移动鼠标,移动鼠标,按下鼠标左键。这些事件将汇总为一个事件,具有鼠标的开始和结束位置。
Name Type Default Description
canvas Canvas document optional 处理事件的元素。
See:

Members

anyButtonDown : Boolean

获取是否按下任何鼠标键,开始触摸或移动滚轮。
获取当前鼠标位置。

Methods

销毁此对象持有的WebGL资源。

一旦对象被销毁,它将不能在使用; 调用除isDestroyed之外的任何函数都会导致DeveloperError异常。 因此,将返回值(undefined)赋给对象,如示例所示。
Throws:
Example:
handler = handler && handler.destroy();
See:

getButtonPressTime(type, modifier)Date

获取按钮被按下时的时间。
Name Type Description
type CameraEventType 相机事件类型。
modifier KeyboardEventModifier optional 键盘编辑器。
Returns:
按钮被按下时的时间。

getButtonReleaseTime(type, modifier)Date

获取按钮被释放的时间。
Name Type Description
type CameraEventType 相机事件类型。
modifier KeyboardEventModifier optional 键盘编辑器。
Returns:
按钮被释放的时间。

getLastMovement(type, modifier)Object|undefined

获取最后一个移动事件(而不是聚合事件)的开始和结束位置。
Name Type Description
type CameraEventType 相机事件类型。
modifier KeyboardEventModifier optional 键盘编辑器
Returns:
一个具有两个Cartesian2属性的对象:startPositionendPositionundefined

getMovement(type, modifier)Object

获取当前事件的聚合开始和结束位置。
Name Type Description
type CameraEventType 相机事件类型。
modifier KeyboardEventModifier optional 键盘编辑器
Returns:
一个具有两个Cartesian2属性的对象:startPositionendPosition

getStartMousePosition(type, modifier)Cartesian2

获取开始聚合的鼠标位置。
Name Type Description
type CameraEventType 相机事件类型。
modifier KeyboardEventModifier optional 键盘编辑器。
Returns:
鼠标位置。

isButtonDown(type, modifier)Boolean

获取鼠标是否按下,或者触摸是否开始。
Name Type Description
type CameraEventType 相机事件类型。
modifier KeyboardEventModifier optional 键盘编辑器。
Returns:
如果鼠标已经按下,返回true。

isDestroyed()Boolean

如果该对象没被销毁,返回false。

如果该对象已经被销毁, 使用isDestroyed 会触发 DeveloperError 异常。
Returns:
false
See:

isMoving(type, modifier)Boolean

获取鼠标按钮是否按下或触摸并已移动。
Name Type Description
type CameraEventType 相机事件类型。
modifier KeyboardEventModifier optional 键盘编辑器
Returns:
如果鼠标按下并开始移动,返回true。
表示已处理所有事件,应重置聚合器以处理新事件。