Skip to content

zoom rubberband behaviour #6176

Closed
Closed
@mzechmeister

Description

@mzechmeister

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.

Activity

alexcjohnson

alexcjohnson commented on May 9, 2022

@alexcjohnson
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

mzechmeister commented on May 9, 2022

@mzechmeister
Author

@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

gvwilson commented on Jul 3, 2024

@gvwilson
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gvwilson@alexcjohnson@mzechmeister

        Issue actions

          zoom rubberband behaviour · Issue #6176 · plotly/plotly.js