Skip to content
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

Possibly hacky fix for the zoom to nowhere bug. #4887

Closed
wants to merge 1 commit into from
Closed

Conversation

kring
Copy link
Member

@kring kring commented Jan 19, 2017

Fixes #4855

I haven't updated CHANGES.md or even thought about writing a test for this yet, because I'm not confident in it. It'd be good if @bagnell could take a quick look first.

The story is, there's a (slow) system in a demo lab here that I can reproduce #4855 on every single time. I just pan over to Australia and zoom in to Cradle Mountain in Tasmania using right-click drag. Before I manage to zoom in close, I'll suddenly end up somewhere in the Atlantic.

@duvifn noted that on his system, this happens when the target position that we're zooming toward is behind the camera. Same thing on my system (thanks for that @duvifn, saved me a lot of time!). That target comes from _zoomWorldPosition, and in the frame where this happens, _zoomWorldPosition is not updated because the mouse hasn't moved.

So I think what is happening is this:

  • I'm zooming in, and there's inertia.
  • Since the last frame, the mouse hasn't moved but (due to inertia) the camera has. Because the system is super slow, the frame rate is low and the camera has actually moved quite a lot since the last frame.
  • Because the mouse position hasn't moved, handleZoom doesn't think it needs to update _zoomWorldPosition, but actually it does because the target point last frame was somewhere much different because the camera moved so much.

So my solution in this PR is to recompute _zoomWorldPosition even if the mouse didn't move. Fixes it on my slow system.

@kring
Copy link
Member Author

kring commented Jan 19, 2017

Not a useful fix, see comments in #4855. Closing.

@kring kring closed this Jan 19, 2017
@kring kring deleted the zoomToNowhere branch January 19, 2017 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zooming scroll wheel too fast zooms through the globe to other side
1 participant