diff --git a/masonry/src/event.rs b/masonry/src/event.rs index cf0ba511..4d6536d9 100644 --- a/masonry/src/event.rs +++ b/masonry/src/event.rs @@ -195,6 +195,7 @@ pub enum PointerEvent { HoverFile(PathBuf, PointerState), DropFile(PathBuf, PointerState), HoverFileCancel(PointerState), + Pinch(f64, PointerState), } // TODO - Clipboard Paste? @@ -369,7 +370,8 @@ impl PointerEvent { | PointerEvent::MouseWheel(_, state) | PointerEvent::HoverFile(_, state) | PointerEvent::DropFile(_, state) - | PointerEvent::HoverFileCancel(state) => state, + | PointerEvent::HoverFileCancel(state) + | PointerEvent::Pinch(_, state) => state, } } @@ -391,6 +393,7 @@ impl PointerEvent { PointerEvent::HoverFile(_, _) => "HoverFile", PointerEvent::DropFile(_, _) => "DropFile", PointerEvent::HoverFileCancel(_) => "HoverFileCancel", + PointerEvent::Pinch(_, _) => "Pinch", } } @@ -405,6 +408,7 @@ impl PointerEvent { PointerEvent::HoverFile(_, _) => true, PointerEvent::DropFile(_, _) => false, PointerEvent::HoverFileCancel(_) => false, + PointerEvent::Pinch(_, _) => true, } } } diff --git a/masonry/src/event_loop_runner.rs b/masonry/src/event_loop_runner.rs index 78b7f884..47b6a264 100644 --- a/masonry/src/event_loop_runner.rs +++ b/masonry/src/event_loop_runner.rs @@ -553,6 +553,10 @@ impl MasonryState<'_> { } } } + WinitWindowEvent::PinchGesture { delta, .. } => { + self.render_root + .handle_pointer_event(PointerEvent::Pinch(delta, self.pointer_state.clone())); + } _ => (), }