Skip to content

Commit

Permalink
Update input_state.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Apr 27, 2024
1 parent 2ab1850 commit 898d7e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/egui/src/input_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ impl InputState {
}
}

pub fn create_scroll_delta(&mut self, is_begin_frame: bool, is_contain_pointer: bool) {
if !is_begin_frame && !is_contain_pointer {
pub fn create_scroll_delta(&mut self, is_begin_frame: bool, is_contains_pointer: bool) {
if !is_begin_frame && !is_contains_pointer {
return;
}

// Mouse wheels often go very large steps.
// A single notch on a logitech mouse wheel connected to a Macbook returns 14.0 raw_scroll_delta.
// So we smooth it out over several frames for a nicer user experience when scrolling in egui.
if !is_begin_frame && is_contain_pointer {
if !is_begin_frame && is_contains_pointer {
self.unprocessed_scroll_delta += self.raw_scroll_delta;
self.raw_scroll_delta = Vec2::ZERO;
}
Expand Down

0 comments on commit 898d7e5

Please sign in to comment.