-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix zooming out speed after reaching minimum zoom distance. #9932
Fix zooming out speed after reaching minimum zoom distance. #9932
Conversation
Thanks for the pull request @puckey!
Reviewers, don't forget to make sure that:
|
c1a9c33
to
a82aef3
Compare
any news on this? |
Note that you can see this in production on http://radio.garden - zoom in all the way and out again |
Yeah, that's great, but is there any reason to stop merging to master, can you fix that? |
Thanks @puckey! I was able to test this out with both the mouse and touch controls. Both are now snappier once the minimum has been reached. Since this changes existing behavior, can you add a note to |
// distanceMeasure should be the height above the ellipsoid. | ||
// The zoomRate slows as it approaches the surface and stops minimumZoomDistance above it. | ||
var minHeight = object.minimumZoomDistance * percentage; | ||
var minHeight = diff < 0 ? 0 : object.minimumZoomDistance * percentage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability, can you either 1) break this out into a descriptive variable, or 2) expand on the comment above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it to:
// distanceMeasure should be the height above the ellipsoid.
// When approaching the surface, the zoomRate slows and stops minimumZoomDistance above it.
var approachingSurface = diff > 0;
var minHeight = approachingSurface ? object.minimumZoomDistance * percentage : 0;
var maxHeight = object.maximumZoomDistance;
a82aef3
to
8e313d9
Compare
8e313d9
to
5b75a74
Compare
@ggetz Thanks for reviewing – I added a note about the changes to CHANGES.md |
Awesome, thanks again @puckey! |
The minimum zoom distance causes the zoom speed to slow as you arrive at the minimum zoom. This feels right, but when you zoom back out again from that minimum zoom, the zooming takes too long to get up to speed.
In the following demo, use your scroll wheel to zoom in as far as you can and then try zooming out again:
Sandcastle demo: https://sandcastle.cesium.com/#c=bY5PSwMxEMW/SsipBUkoBSuYLsL2KHgoeJBcptlRByfJkj9b6qc3u72Idg4Db+b33swESUyEZ0xiLwKeRY+Zqlevy2xlpVt0H0MBCpisXD/acHWo7DBg6wkxHEdw2IPHBDOcInMjPAXy1b/F6A+UCwSH7c79dvew2e5akLyTJpcLY2eDWOqJ/BhTETXxSild0I8MBbM+VfeFRbmc5w9m1OjfVjPQJGjY33hZOIac2+a9Mh/pG63sjG78PytHGCh8vEyYGC4z9rnpnq9DpZTRTd52lhj5BOlP8g8
When specifying a minimum zoom distance like so:
This pull request avoids slowing down zooming as you zoom out.