ScreenSpaceEventHandler - Cesium Documentation

# ScreenSpaceEventHandler

#### new ScreenSpaceEventHandler(element)

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

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

  Source: Core/ScreenSpaceEventHandler.js, line 644

### Methods

#### destroy() → undefined

  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.

  ##### Returns:

  ##### Throws:

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

  ##### Example:

      handler = handler && handler.destroy();

  ##### See:

  - ScreenSpaceEventHandler#isDestroyed
  Source: Core/ScreenSpaceEventHandler.js, line 765

#### getInputAction(type, modifier)

  Returns the function to be executed on an input event.

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

  ##### See:

  - ScreenSpaceEventHandler#setInputAction
  - ScreenSpaceEventHandler#removeInputAction
  Source: Core/ScreenSpaceEventHandler.js, line 703

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

  ##### Returns:

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

  ##### See:

  - ScreenSpaceEventHandler#destroy
  Source: Core/ScreenSpaceEventHandler.js, line 745

#### removeInputAction(type, modifier)

  Removes the function to be executed on an input event.

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

  ##### See:

  - ScreenSpaceEventHandler#getInputAction
  - ScreenSpaceEventHandler#setInputAction
  Source: Core/ScreenSpaceEventHandler.js, line 724

#### setInputAction(action, type, modifier)

  Set a function to be executed on an input event.

  Name | Type | Description
  --- | --- | ---
  `action` | function | Function to be executed when the input event occurs.
  `type` | Number | The ScreenSpaceEventType of input event.
  `modifier` | Number | optional A KeyboardEventModifier key that is held when a `type` event occurs.

  ##### See:

  - ScreenSpaceEventHandler#getInputAction
  - ScreenSpaceEventHandler#removeInputAction
  Source: Core/ScreenSpaceEventHandler.js, line 679