Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

lucasgruwez
Copy link

PR summary

Tangent to #30541
Allows for zooming in a single axis using the zoom rectangle by dragging only in one direction.

Screen.Recording.2025-09-14.at.01.37.29.mov

PR checklist

@rcomer
Copy link
Member

rcomer commented Sep 13, 2025

I note that the existing x-/y- modifiers do not really work when using my laptop's touchpad1, but this proposal does work nicely 👍

Footnotes

  1. If I hold x and the left button, nothing happens when I drag. I can get it to work by making the box and then pressing x before I let go, but I don't get the visual of the box turning into two parallel lines. If I use an external mouse, everything works as it should so it definitely seems to be an issue with the touchpad.

@timhoffm
Copy link
Member

This is an interesting concept, though I was a bit surprised at first. Is there any precedence that other programs use this approach?

Also, would it be a good idea to give some sort of visual aide, with the goals (i) to make it clear that something special is going on and (ii) give an indication of the area the mouse has to be in so that the special handling applies? e.g. something like marking the region:
grafik

@lucasgruwez
Copy link
Author

Matlab has similar behavior. Could implement something similar where the lines at the edge indicate the region the mouse needs to be in?

Screen.Recording.2025-09-14.at.19.18.48.mov

@timhoffm
Copy link
Member

timhoffm commented Sep 14, 2025

The range marker is a good visualization to indicate the difference. Though, I would like to additionally keep dashed lines as an extension of the whiskers, because that helps to ensure relevant data points are included.

That said, all the visual changes would need refactoring and backend-dependent implementation as currently all visualization is done via RubberBandBase and that does only cover the rectangle without the ability for further modification.

class RubberbandBase(ToolBase):

@lucasgruwez
Copy link
Author

Example of whiskers and dashed rectangle using QtCairo and QtAgg backends. The width of the whiskers represents the region the mouse needs to be in for single-axis zoom.

Excuse the lack of mouse pointer in the screenshot.

Screenshot 2025-09-14 at 23 10 09

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

Successfully merging this pull request may close these issues.

3 participants