Skip to content

Support trackpad pinch-to-zoom on the plot views #9

Description

@LiukDiihMieu

Idea

Add pinch-to-zoom (two-finger pinch/spread) on the image / histogram / line-plot views, in addition to the existing two-finger scroll zoom (which already works via matplotlib's scroll_event).

Why it's non-trivial

Pinch is not a scroll/wheel event, so matplotlib's scroll_event never sees it. It arrives as a Qt native gesture (QNativeGestureEvent, type Qt.ZoomNativeGesture), whose value() gives the incremental scale. We'd need to intercept it on the FigureCanvas widget (override event() / nativeGestureEvent) and map the scale delta onto the axes limits, reusing the existing zoom-around-cursor math in each view's _on_scroll.

Platform caveat

  • macOS and Wayland (libinput) deliver pinch as native gestures — should work.
  • X11 historically does not deliver pinch gestures to Qt, so this may be a no-op there. Worth verifying on the target setups before committing to it.

Lower priority — two-finger scroll zoom already covers the common case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredIntentionally postponed; not a current priorityenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions