Skip to content

zoom rubberband behaviour #6176

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

Closed
mzechmeister opened this issue May 4, 2022 · 3 comments
Closed

zoom rubberband behaviour #6176

mzechmeister opened this issue May 4, 2022 · 3 comments

Comments

@mzechmeister
Copy link

mzechmeister commented May 4, 2022

The zoom modes I have seen in plotly are based on drawing rectangles and boxes by the user.
In qt applications I have experienced another nice zoom behaviour; it seems it is called "rubberband drag".
It works like that:
A right click creates a virtual center and when moving the mouse with the right button hold pressed, the zoom depends on the relative coordinates with respected to the virtual point.
It is a smooth zoom and feels similar to mousewheel zoom, but in two dimensions and symmetrically.

Can this be implemented as zoom mode option in plotly, too? Is there a quick hack to get it now?

Added: It just come to my mind that it also similar to a two finger zoom, also called pinch zoom (e.g. #480). That might be starting point.

@alexcjohnson
Copy link
Collaborator

Thanks @mzechmeister - I think I've seen the effect you're referring to in PyQtGraph. To rephrase just to make sure I understand your suggestion clearly: in this mode while the mouse is down horizontal movement would zoom the x axis in or out and vertical movement would zoom the y axis in or out, all relative to the mouse position at mousedown.

I agree that this is a very efficient way to navigate certain kinds of graphs. It takes some getting used to but we'd be happy to have this as a new dragmode setting if someone would like to add it.

@mzechmeister
Copy link
Author

mzechmeister commented May 9, 2022

@alexcjohnson Thanks for consideration.

Meanwhile, I found a way to hack it in. Thus I can demostrate it:
https://gist.github.com/mzechmeister/c3f0557b0bb87f6b410d6d49e1124bda
https://gistpreview.github.io/?c3f0557b0bb87f6b410d6d49e1124bda
https://jsfiddle.net/7rskne05

Unfortunately, there is no native support in javascript for drag with right mouseclick. Thus it needed to be emulated.
Also, there is a zoom bug in plotly (#5311), which I worked around via toggling fixedrange.
And there is a little short coming due to imprecise p2c conversion (#1548).

Enjoy

@gvwilson
Copy link
Contributor

gvwilson commented Jul 3, 2024

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

@gvwilson gvwilson closed this as completed Jul 3, 2024
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

No branches or pull requests

3 participants