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

Projection is wrong while dragging and nudging/zooming #3594

Closed
bhousel opened this issue Nov 18, 2016 · 2 comments
Closed

Projection is wrong while dragging and nudging/zooming #3594

bhousel opened this issue Nov 18, 2016 · 2 comments
Labels
bug A bug - let's fix this!

Comments

@bhousel
Copy link
Member

bhousel commented Nov 18, 2016

In drag modes, if the user moves towards the edge of the screen, and the nudge happens - or when the user mousewheels - the projection does not update properly. This causes weird jumpiness..

jumpy

@bhousel bhousel added the bug A bug - let's fix this! label Nov 18, 2016
@bhousel
Copy link
Member Author

bhousel commented Jan 28, 2017

I did some investigation into this today. I think the issue is that drag.js sets the origin in screen coordinates , which would then go stale if nudges and zooms happen while the drag is active, changing the origin. Instead it should save the origin in world coordinates and project/unproject as necessary.

bhousel added a commit that referenced this issue Jan 29, 2017
@bhousel
Copy link
Member Author

bhousel commented Jan 29, 2017

fixed in f93e57b Use #map.node() for drag surface instead of svg

The bug was not actually related to the thing I said before with the origin point.
The issue was that #surface can be transformed during a partial redraw
and d3.mouse() was returning transformed point, not the real screen point.
https://github.com/d3/d3-selection/blob/a2cf4f32ec2a88196c9f992e34ec23aec589f797/src/point.js#L4-L9

The draw behavior has similar code, but correctly uses the container object for screen coordinate reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug - let's fix this!
Projects
None yet
Development

No branches or pull requests

1 participant