# ScreenSpaceEventHandler

#### new Cesium.ScreenSpaceEventHandler(element)
engine/Source/Core/ScreenSpaceEventHandler.js 977

Handles user input events. Custom functions can be added to be executed on when the user enters input.

Name | Type | Default | Description
--- | --- | --- | ---
`element` | HTMLCanvasElement | `document` | optional The element to add events to.

### Members

#### static Cesium.ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds : number
engine/Source/Core/ScreenSpaceEventHandler.js 1127

The amount of time, in milliseconds, that mouse events will be disabled after receiving any touch events, such that any emulated mouse events will be ignored.

Default Value: `800`

#### static Cesium.ScreenSpaceEventHandler.touchHoldDelayMilliseconds : number
engine/Source/Core/ScreenSpaceEventHandler.js 1135

The amount of time, in milliseconds, before a touch on the screen becomes a touch and hold.

Default Value: `1500`

### Methods

#### destroy()
engine/Source/Core/ScreenSpaceEventHandler.js 1115

Removes 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.

##### Throws:

- DeveloperError : This object was destroyed, i.e., destroy() was called.

##### Example:

    handler = handler && handler.destroy();

##### See:

- ScreenSpaceEventHandler#isDestroyed

#### getInputAction(type, modifier) → ScreenSpaceEventHandler.PositionedEventCallback|ScreenSpaceEventHandler.MotionEventCallback|ScreenSpaceEventHandler.WheelEventCallback|ScreenSpaceEventHandler.TwoPointEventCallback|ScreenSpaceEventHandler.TwoPointMotionEventCallback
engine/Source/Core/ScreenSpaceEventHandler.js 1051

Returns the function to be executed on an input event.

Name | Type | Description
--- | --- | ---
`type` | ScreenSpaceEventType | The ScreenSpaceEventType of input event.
`modifier` | KeyboardEventModifier | optional A KeyboardEventModifier key that is held when a `type` event occurs.

##### Returns:

The function to be executed on an input event.

##### See:

- ScreenSpaceEventHandler#setInputAction
- ScreenSpaceEventHandler#removeInputAction

#### isDestroyed() → boolean
engine/Source/Core/ScreenSpaceEventHandler.js 1096

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.

##### Returns:

`true` if this object was destroyed; otherwise, `false`.

##### See:

- ScreenSpaceEventHandler#destroy

#### removeInputAction(type, modifier)
engine/Source/Core/ScreenSpaceEventHandler.js 1072

Removes the function to be executed on an input event.

Name | Type | Description
--- | --- | ---
`type` | ScreenSpaceEventType | The ScreenSpaceEventType of input event.
`modifier` | KeyboardEventModifier | optional A KeyboardEventModifier key that is held when a `type` event occurs.

##### See:

- ScreenSpaceEventHandler#getInputAction
- ScreenSpaceEventHandler#setInputAction

#### setInputAction(action, type, modifier)
engine/Source/Core/ScreenSpaceEventHandler.js 1021

Set a function to be executed on an input event.

Name | Type | Description
--- | --- | ---
`action` | ScreenSpaceEventHandler.PositionedEventCallback | ScreenSpaceEventHandler.MotionEventCallback | ScreenSpaceEventHandler.WheelEventCallback | ScreenSpaceEventHandler.TwoPointEventCallback | ScreenSpaceEventHandler.TwoPointMotionEventCallback | Function to be executed when the input event occurs.
`type` | ScreenSpaceEventType | The ScreenSpaceEventType of input event.
`modifier` | KeyboardEventModifier | optional A KeyboardEventModifier key that is held when a `type` event occurs.

##### See:

- ScreenSpaceEventHandler#getInputAction
- ScreenSpaceEventHandler#removeInputAction

### Type Definitions

#### Cesium.ScreenSpaceEventHandler.MotionEvent
engine/Source/Core/ScreenSpaceEventHandler.js 906

An Event that starts at one position and ends at another.

##### Properties:

Name | Type | Description
--- | --- | ---
`startPosition` | Cartesian2 |
`endPosition` | Cartesian2 |

#### Cesium.ScreenSpaceEventHandler.MotionEventCallback(event)
engine/Source/Core/ScreenSpaceEventHandler.js 915

Name | Type | Description
--- | --- | ---
`event` | ScreenSpaceEventHandler.MotionEvent | The event which triggered the listener

#### Cesium.ScreenSpaceEventHandler.PositionedEvent
engine/Source/Core/ScreenSpaceEventHandler.js 890

An Event that occurs at a single position on screen.

##### Properties:

Name | Type | Description
--- | --- | ---
`position` | Cartesian2 |

#### Cesium.ScreenSpaceEventHandler.PositionedEventCallback(event)
engine/Source/Core/ScreenSpaceEventHandler.js 898

Name | Type | Description
--- | --- | ---
`event` | ScreenSpaceEventHandler.PositionedEvent | The event which triggered the listener

#### Cesium.ScreenSpaceEventHandler.TwoPointEvent
engine/Source/Core/ScreenSpaceEventHandler.js 923

An Event that occurs at a two positions on screen.

##### Properties:

Name | Type | Description
--- | --- | ---
`position1` | Cartesian2 |
`position2` | Cartesian2 |

#### Cesium.ScreenSpaceEventHandler.TwoPointEventCallback(event)
engine/Source/Core/ScreenSpaceEventHandler.js 932

Name | Type | Description
--- | --- | ---
`event` | ScreenSpaceEventHandler.TwoPointEvent | The event which triggered the listener

#### Cesium.ScreenSpaceEventHandler.TwoPointMotionEvent
engine/Source/Core/ScreenSpaceEventHandler.js 940

An Event that starts at a two positions on screen and moves to two other positions.

##### Properties:

Name | Type | Description
--- | --- | ---
`position1` | Cartesian2 |
`position2` | Cartesian2 |
`previousPosition1` | Cartesian2 |
`previousPosition2` | Cartesian2 |

#### Cesium.ScreenSpaceEventHandler.TwoPointMotionEventCallback(event)
engine/Source/Core/ScreenSpaceEventHandler.js 951

Name | Type | Description
--- | --- | ---
`event` | ScreenSpaceEventHandler.TwoPointMotionEvent | The event which triggered the listener

#### Cesium.ScreenSpaceEventHandler.WheelEventCallback(delta)
engine/Source/Core/ScreenSpaceEventHandler.js 959

Name | Type | Description
--- | --- | ---
`delta` | number | The amount that the mouse wheel moved

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.