How can I change the zoom step length

91 views
Skip to first unread message

故因

unread,
Aug 31, 2018, 12:28:21 AM8/31/18
to cesium-dev

1. A concise explanation of the problem you're experiencing.

 I want to change the zoom step length, eg: when my mouse wheel scroll once,  camera's height minus 100km.
 Is there a way to modify the step size of the scroll wheel? mouse wheel scroll once,  camera's height minus 50km. I watched the  Cesium.ScreenSpaceCameraController  class, but there seems to be no way to change this.
2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.



3. Context. Why do you need to do this? We might know a better way to accomplish your goal.



4. The Cesium version you're using, your operating system and browser.
1.40,Windows10,Chrome68

Omar Shehata

unread,
Sep 1, 2018, 1:49:27 PM9/1/18
to cesium-dev
Good question! Looks like it's currently a private variable in ScreenSpaceCameraController:


You can see how the zoomFactor is used and how it changes as you get closer to the surface here:


Modifying private properties isn't recommended since the API for those might change in the future, but it could be a quick hack to allow you to control the speed. An even better solution would be to modify the class to make the property public, documenting it and making a contribution to Cesium! It should be a straightforward enough change. Check out the contributing guide here (https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md).
Reply all
Reply to author
Forward
0 new messages