-
Notifications
You must be signed in to change notification settings - Fork 142
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
Allow a reference point to be specified for interactive zooming #211
Comments
Sounds reasonable. These are supported in the programmatic interface #178 #184, but not yet in the wheel and dblclick listeners. Line 219 in c609de4
Line 284 in c609de4
Presumably we could allow a function or a constant, and have it default to d3.mouse (d3.pointer in d3-selection@2) for the current behavior. |
It could be also used for the touch input. |
…e zoom; defaults to d3.pointer fixes #211
More remarks after a first (failed) attempt: scatterplot example:
complete example now at https://observablehq.com/d/9035ed7049aaa8c6 target example:
(issue visible at https://bl.ocks.org/mbostock/6226534, which is d3v3) notebook example with d3@6 (alpha) at https://observablehq.com/d/48ff4a64c477cc79 |
…e wheel event; defaults to d3.pointer fixes #211
Wow, nice work! Looks like the issue is quite interwoven. |
Hey any updates on that? I think Fil's PR does not work anymore with the latest d3. Having the center functionality would be great for data snap on zoom and for some pseudo-3D interactions. |
I am in desparate need for this |
…e wheel event; defaults to d3.pointer fixes #211
I've refreshed #212 (there was a small conflict on README.md), and upgraded the test notebooks. |
In d3 v3 there used to be a zoom.center() to adjust the target point while zooming via mousewheel / touch. Basically you could define a (center) target and when the user does a zoom input the zoom would steer in that direction. This was useful to avoid zooming into dead space of a scatter plot.
I made a workaround for this feature by modifying the zoom transform in the zoom callback and @Fil made a nice hack to override the mouse position
Probably the location to add this feature would be here somewhere here. Instead of using the mouse position we could use a reference point which needs to be declared before.
The text was updated successfully, but these errors were encountered: