Skip to content

Forward trackpad pinch (magnify) gestures as mouse::Event::PinchGesture#3377

Open
hn63wospuvy wants to merge 1 commit into
iced-rs:masterfrom
hn63wospuvy:feat/trackpad-pinch-gesture
Open

Forward trackpad pinch (magnify) gestures as mouse::Event::PinchGesture#3377
hn63wospuvy wants to merge 1 commit into
iced-rs:masterfrom
hn63wospuvy:feat/trackpad-pinch-gesture

Conversation

@hn63wospuvy

Copy link
Copy Markdown

What

winit emits WindowEvent::PinchGesture for trackpad magnify (pinch) gestures, but the iced_winit event conversion dropped it, so applications had no way to implement pinch-to-zoom.

This adds a mouse::Event::PinchGesture { delta } variant and forwards the gesture from the winit backend. delta is the incremental magnification change since the previous event (positive = zooming in / fingers moving apart).

The mouse::Event doc-comment already invites such additions ("This type is largely incomplete! If you need to track additional events, feel free to open an issue and share your use case!").

Changes

  • core: add mouse::Event::PinchGesture { delta: f32 }.
  • winit: convert WindowEvent::PinchGesture -> the new event.

The change is additive (one enum variant + one conversion arm); the full workspace (all crates + examples) compiles.

winit emits `WindowEvent::PinchGesture` for trackpad magnify gestures, but
the winit backend dropped it, so applications had no way to implement
pinch-to-zoom. Add a `mouse::Event::PinchGesture { delta }` variant and
forward the gesture from `iced_winit`'s event conversion.

`delta` is the incremental magnification change (positive = zoom in).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant