CesiumGS / CesiumGS/cesium

Expose camera controller zoomFactor

Open
#7,978 0 comments 1 reaction 0 assignees View on GitHub
category - camera type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

This came up [on the forum](https://groups.google.com/d/msg/cesium-dev/9EB47H0q4oc/yIHvUKn_BwAJ), as a question of how to change the camera's zooming speed. I first tried [camera.defaultZoomAmount](https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=Camera#defaultZoomAmount) but that turns out to only be the zoom speed when no speed is passed.

I then discovered the hidden zoomFactor private variable:

https://github.com/AnalyticalGraphicsInc/cesium/blob/32fc04d9e7e3b26e78ca1ca4b607091846a68c1e/Source/Scene/ScreenSpaceCameraController.js#L304

Note the apt comment here: `// Constants, Make any of these public?`. So right now, you could change the zoomFactor with:

```
viewer.scene.screenSpaceCameraController._zoomFactor = 8; // defaults to 5
```

Contributor guide

Open the contributing guide

Research direction

Start in Source/Scene/ScreenSpaceCameraController.js at the private zoomFactor variable and its surrounding constants comment. Trace how the camera controller uses it, then make the zoom factor publicly configurable and verify that users no longer need to access the private field.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.