inertial input based camera movement is not reset after flyTo completes
- Dominant language
- JavaScript
- Stars
- 15.7k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
I posted the following issue to the cesium-dev mailing list and @OmarShehata thought I should open an issue for it:
> "Thanks for bringing this up. I think this might be a good idea to open a GitHub issue for. I think your code example does a good job showing the issue. There's no way to reset the camera's velocity from the public API, and I wonder if it's best to just automatically do this when a flyTo happens."
**1. A concise explanation of the problem you're experiencing.**
I swipe the globe, causing it to rotate and slow down with inertia.
While it is still rotating from the swipe, I click on a button causing a camera.flyTo to a position on the map.
The problem I am seeing is that after the flyTo is complete, the globe continues to move in the inertial direction it was before the flyTo.
I am looking for a way to reset the camera movement caused by input, so the globe does not continue to move after the camera flight is complete.
**2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.**
I made the following codesandbox illustrating the issue: https://codesandbox.io/s/focused-hill-otlr5
Click, drag and release the globe in any direction to give it some intertial movement.
200ms after releasing the mouse, the code does a camera.flyTo to moscow.
You should see intertial movement after the camera flyTo has occurred.
I was able to work around the issue using private APIs by recreating the ScreenSpaceCameraController before the camera.flyTo. As you can see in the following codesandbox, when swiping the globe, the camera stops right after the flyTo: https://codesandbox.io/s/relaxed-margulis-mlff6
**3. Context. Why do you need to do this? We might know a better way to accomplish your goal.**
I have a globe filled with markers. When you click on a marker, I want to fly to that position. Currently after the flyto is done, I sometimes see leftover inertial globe movement from user input. This causes the resulting globe position to be imprecise.
**4. The Cesium version you're using, your operating system and browser.**
Demo is running on Cesium 1.64. My OS is OSX Catalina on latest Chrome 78.
Contributor guide
Research direction
Start with the linked CodeSandbox reproduction and compare the public camera.flyTo behavior with the ScreenSpaceCameraController workaround described in the issue. Confirm that inertial movement from the swipe no longer continues after the flight completes, while preserving normal camera flight behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100