Skip to content

[ENH]: Zoom in/out on rolling the mouse wheel #28412

Closed

Activity

  1. timhoffm commented on Jun 18, 2024

    @timhoffm
    Member

    See #20317 as a proof of concept.

    What needs to be done:

    • Decide on the exact behavior
    • Implement across all backends.

    Help is welcome.

  2. MischaMegens2 commented on Jun 18, 2024

    @MischaMegens2
    ContributorAuthor

    And there is also #18159.

  3. MischaMegens2 commented on Jun 18, 2024

    @MischaMegens2
    ContributorAuthor

    As for requirements:
    I don't think removing the toolbar Zoom and Pan buttons altogether is opportune:

    • The UI should work even if you don't know/remember which mouse key or control key combination you have to use to be able to pan or zoom.
    • We still want to enable/disable manipulations of the plot, since users may have implemented other mouse-interaction interfaces which may otherwise interfere (anntzer).

    So I'd suggest we limit the changes to:

    • only in pan mode and zoom mode
    • rolling the mouse wheel: zoom in/out, around position of the mouse pointer;
      in combination with ctrl, or with shift: zoom only horizontally, or only vertically
    • I think letting the mouse wheel pan vertically is a mistake (a graph is not text)
    • leave the mouse click-and-drag for pan and zoom alone for now (unchanged)
  4. timhoffm commented on Jun 19, 2024

    @timhoffm
    Member
    • in combination with ctrl, or with shift: zoom only horizontally, or only vertically

    Are these standard combinations? If not, we should carefully consider which modifiers should which operations.

  5. MischaMegens2 commented on Jun 19, 2024

    @MischaMegens2
    ContributorAuthor
    • in combination with ctrl, or with shift: zoom only horizontally, or only vertically

    Are these standard combinations? If not, we should carefully consider which modifiers should which operations.

    It seems there are no standard modifiers. (It seems there is even disagreement as to which way of rolling the wheel zooms 'in' vs. 'out'). rcParams are in order. But the use of modifiers generalizes nicely for 3d plots ('alt' for only zooming x axis, 'ctrl' for y, 'shift' for z'; 'ctrl+shift' for zooming in x and y while leaving z fixed, etc.)

    Alternatively, when the mouse pointer is over an axis, we could zoom in the corresponding direction only.

    Or both functionalities could be provided.

  6. timhoffm commented on Jul 17, 2024

    @timhoffm
    Member

    Minimal proposal: Scroll up/down without modifiers = zoom in/out to the cursor, keeping aspect ratio.

    Direction: Consistent with zooming in maps, and browsers (while they additionally need a modifier, the up=magnification relation matches)

    Modifiers can be discussed and added later.

  7. MischaMegens2 commented on Jul 17, 2024

    @MischaMegens2
    ContributorAuthor

    the up=magnification connection mathes

    ?

  8. timhoffm commented on Jul 17, 2024

    @timhoffm
    Member

    Typo. Both cases interpret scroll-up as magnification

  9. added this to the v3.11.0 milestone on Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions