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.
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_eventnever sees it. It arrives as a Qt native gesture (QNativeGestureEvent, typeQt.ZoomNativeGesture), whosevalue()gives the incremental scale. We'd need to intercept it on theFigureCanvaswidget (overrideevent()/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
Lower priority — two-finger scroll zoom already covers the common case.