ScreenSpaceMapCameraController

A camera controller that allows panning the camera tangential to the ellipsoid in screen space by clicking and dragging the mouse.

new Cesium.ScreenSpaceMapCameraController(options)

Creates an instance of a ScreenSpaceMapCameraController.
Name Type Description
options ScreenSpaceMapCameraController.ControllerOptions optional The options for configuring the controller.
Examples:
viewer.scene.screenSpaceCameraController.enableInputs = false;

const mapCameraController = new Cesium.ScreenSpaceMapCameraController();
viewer.addController(mapCameraController);
// Configure the controller to use the right mouse button for panning instead of the default left mouse button.
const mapCameraController = new Cesium.ScreenSpaceMapCameraController({
 dragInputs: [{ button: Cesium.MouseButton.RIGHT}]
});
viewer.addController(mapCameraController);

Members

The drag input bindings that map panning. Each binding is a combination of the mouse button and an optional keyboard modifier.
See:
Determines if the controller is enabled and should be updated by the host scene.
Enable or disable inertia when panning. When enabled, the camera will continue to move after the user stops dragging, gradually slowing down based on ScreenSpaceMapCameraController#inertialDecay.
Default Value: true
The rate at which the camera's pan velocity decays over time.
Default Value: 6.0
A parameter in the range [0, 1) used to limit the range of inputs to a percentage of the window width/height per animation frame. This helps keep the camera under control in low-frame-rate situations.
Default Value: 0.1
The speed in meters per pixel at which the camera pans.
Default Value: 1.0
A callback function used to pick the world position from which to pan. The function is called with Scene, the Cartesian2 screen space position, and a Cartesian3 instance to store the result. The function should return the Cartesian3 world position from which to pan, or undefined if no position could be picked. If undefined is returned, the camera will pan relative to the ellipsoid surface below the camera.
Default Value: defaultPickWorldPosition
Example:
const mapCameraController = new Cesium.ScreenSpaceMapCameraController();
mapCameraController.pickWorldPosition = function (scene, windowPosition, result) {
  // Pick the world position from the depth buffer
  return scene.pickPosition(windowPosition, result);
};
viewer.addController(mapCameraController);

Methods

Invoked when the controller is added to the DOM. Implement connectedCallback to set up any DOM event listeners.
Name Type Description
element HTMLElement The DOM element containing the Cesium scene.

disconnectedCallback(element)

Invoked when the controller is removed from the DOM. Implement disconnectedCallback to tear down any DOM event listeners.
Name Type Description
element HTMLElement The DOM element containing the Cesium scene.
Invoked when the controller is being updated the first time, immediately before update is called. Implement firstUpdate to perform one-time work after the relevant scene has begun its render loop. Some examples might include initializing simulation time values or adding a primitive to the scene.
Name Type Description
scene Scene
time JulianDate The current simulation time.
See:
Invoked once per frame. Implement update to modify the camera or other parts of the scene.
Name Type Description
scene Scene
time JulianDate The current simulation time.
See:

Type Definitions

Cesium.ScreenSpaceMapCameraController.ControllerOptions

Properties:
Name Type Attributes Description
dragInputs Array.<ScreenSpaceInputBindings.InputBinding> <optional>
The drag input bindings that control panning.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.