# SpaceMouseOperator

class Operators.SpaceMouseOperator()

  Provide camera movement for the 3Dconnexion SpaceMouse.

Constructors

- `constructor()`

Methods

- `addMapping()`

- `clearMapping()`

- `connect()`

- `setMapping()`

## Constructors

SpaceMouseOperator.constructor(viewer, view)
  Arguments

    - viewer (`WebViewer()`) – None

    - view (`View()`) – None

  Return type

    SpaceMouseOperator

## Methods

### addMapping

SpaceMouseOperator.addMapping(button, modifier)
  Arguments

    - button (`Button()`) – None

    - modifier (`KeyModifiers()`) – None

  Adds a button and key modifier mapping for the operator. If no mapping is provided, all combinations are considered valid. All mappings require a mouse button, but a key modifier is optional.

  Return type

    void

### clearMapping

SpaceMouseOperator.clearMapping()

  Clears any button and key modifier mappings for the operator.

  Return type

    void

### connect

SpaceMouseOperator.connect()

  Connect to the space mouse. To be successful, this method should be called in the sceneReady callback. If you want to connect at a later time, the canvas where the mouse is to be used must have focus.

  Note: If this is called but the 3d connexion software is not running, a connection error will be shown in the console.

  Return type

    void

### setMapping

SpaceMouseOperator.setMapping(button, modifier)
  Arguments

    - button (`Button()`) – None

    - modifier (`KeyModifiers()`) – None

  Sets the button and key modifier mapping for the operator.

  Return type

    void