CesiumGS / CesiumGS/cesium

Camera moveStart and moveEnd events don't work when camera is very close to the ground

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

Description

Reported on the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/SwoFMPNm5_g

This is particularly noticeable in 2D

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer', {
sceneMode: Cesium.SceneMode.SCENE2D
});

var camera = viewer.camera;
camera.moveStart.addEventListener(function() {
console.log('start');
});
camera.moveEnd.addEventListener(function() {
console.log('end');
});
```

1. Zoom in all the way (you should see start/end print out to the console)
2. Use the scroll wheel to zoom out one click at a time (start/end don't print out to the console until you're zoomed out a bit)

It looks like we are using `EPSILON6`, which is not significant enough when the camera is very close to the ground: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Scene.js#L2349

The camera changed event does a much better job because it takes the camera height into consideration: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Camera.js#L336

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the SCENE2D viewer and the camera moveStart/moveEnd listeners from the report. Read the camera movement handling near Source/Scene/Scene.js:2349 and compare it with the camera changed event near Source/Scene/Camera.js:336, which accounts for camera height. Done means the events reliably print when zooming near the ground, including one-click scroll-wheel changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.