From 042e1add412873756554fd4dea986ddc9d7d5303 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 4 Jul 2024 10:31:27 +0200 Subject: [PATCH] Better documentation for `Event::Zoom` (#4778) * Closes https://github.com/emilk/egui/issues/4777 Also add this to the 0.28 migration guide. --- CHANGELOG.md | 1 + crates/egui/src/data/input.rs | 8 +++++++- crates/egui/src/input_state.rs | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eab55732..d35ef47c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Changes since the last release can be found at 1`: pinch spread + /// + /// Note that egui also implement zooming by holding `Ctrl` and scrolling the mouse wheel, + /// so integration need NOT emit this `Zoom` event in those cases, just [`Self::MouseWheel`]. + /// + /// As a user, check [`crate::InputState::smooth_scroll_delta`] to see if the user did any zooming this frame. Zoom(f32), /// IME Event diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index abd6028b..ad0e7b41 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -27,6 +27,8 @@ const MAX_DOUBLE_CLICK_DELAY: f64 = 0.3; // TODO(emilk): move to settings /// Input state that egui updates each frame. /// +/// You can access this with [`crate::Context::input`]. +/// /// You can check if `egui` is using the inputs using /// [`crate::Context::wants_pointer_input`] and [`crate::Context::wants_keyboard_input`]. #[derive(Clone, Debug)]