From 7d0f4d3ea22a9a102b652b0551656f7d3c8a688f Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:37:41 +0900 Subject: [PATCH 01/16] Update context.rs --- crates/egui/src/context.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index aa8a0b13e32..4e06077dd1f 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1078,6 +1078,14 @@ impl Context { .map_or(false, |response| response.contains_pointer) } + pub(crate) fn create_scroll_delta(&self, inner_rect: Rect) { + self.input_mut(|input| { + let pointer_position = input.pointer.interact_pos().unwrap_or_default(); + let is_contain = inner_rect.contains(pointer_position); + input.create_scroll_delta(false, is_contain); + }); + } + /// Do all interaction for an existing widget, without (re-)registering it. fn get_response(&self, widget_rect: WidgetRect) -> Response { let WidgetRect { From ecb14874d15ead5a1d1a9dc72e8f43466af3a37d Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:38:34 +0900 Subject: [PATCH 02/16] Update input_state.rs --- crates/egui/src/input_state.rs | 61 +++++++++++++++++++--------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 9c6103e0a54..4232e6a9a77 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -196,9 +196,9 @@ impl InputState { for touch_state in self.touch_states.values_mut() { touch_state.begin_frame(time, &new, self.pointer.interact_pos); } - let pointer = self.pointer.begin_frame(time, &new); + let pointer = self.pointer.clone().begin_frame(time, &new); - let mut keys_down = self.keys_down; + let mut keys_down = self.keys_down.clone(); let mut raw_scroll_delta = Vec2::ZERO; let mut zoom_factor_delta = 1.0; for event in &mut new.events { @@ -226,35 +226,15 @@ impl InputState { } } - let mut unprocessed_scroll_delta = self.unprocessed_scroll_delta; - - let mut smooth_scroll_delta = Vec2::ZERO; - - { - // 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. - unprocessed_scroll_delta += raw_scroll_delta; - let dt = stable_dt.at_most(0.1); - let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); // reach _% in _ seconds. TODO(emilk): parameterize - - for d in 0..2 { - if unprocessed_scroll_delta[d].abs() < 1.0 { - smooth_scroll_delta[d] = unprocessed_scroll_delta[d]; - unprocessed_scroll_delta[d] = 0.0; - } else { - smooth_scroll_delta[d] = t * unprocessed_scroll_delta[d]; - unprocessed_scroll_delta[d] -= smooth_scroll_delta[d]; - } - } - } + self.smooth_scroll_delta = Vec2::ZERO; + self.create_scroll_delta(true, false); Self { pointer, touch_states: self.touch_states, - unprocessed_scroll_delta, + unprocessed_scroll_delta: self.unprocessed_scroll_delta, raw_scroll_delta, - smooth_scroll_delta, + smooth_scroll_delta: self.smooth_scroll_delta, zoom_factor_delta, screen_rect, pixels_per_point, @@ -271,6 +251,35 @@ impl InputState { } } + pub fn create_scroll_delta(&mut self, is_begin_frame: bool, is_pointer_contain: bool) { + if !is_begin_frame && !is_pointer_contain { + 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_pointer_contain { + self.unprocessed_scroll_delta += self.raw_scroll_delta; + self.raw_scroll_delta = Vec2::ZERO; + } + + let dt = self.stable_dt.at_most(0.1); + let _t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); // reach _% in _ seconds. TODO(emilk): parameterize + + for d in 0..2 { + if self.unprocessed_scroll_delta[d].abs() < 1.0 { + self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d]; + self.unprocessed_scroll_delta[d] = 0.0; + } else { + // let delta = t * self.unprocessed_scroll_delta[d]; // For Smooth + let delta = self.unprocessed_scroll_delta[d]; + self.smooth_scroll_delta[d] += delta; + self.unprocessed_scroll_delta[d] -= delta; + } + } + } + /// Info about the active viewport #[inline] pub fn viewport(&self) -> &ViewportInfo { From a16b0e1259ed8a2e157c3a62983d4dad49bf09e7 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:43:22 +0900 Subject: [PATCH 03/16] Update scroll_area.rs --- crates/egui/src/containers/scroll_area.rs | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/crates/egui/src/containers/scroll_area.rs b/crates/egui/src/containers/scroll_area.rs index c448269fb0c..cf2ab5fcd15 100644 --- a/crates/egui/src/containers/scroll_area.rs +++ b/crates/egui/src/containers/scroll_area.rs @@ -870,7 +870,13 @@ impl Prepared { let max_offset = content_size - inner_rect.size(); let is_hovering_outer_rect = ui.rect_contains_pointer(outer_rect); - if scrolling_enabled && is_hovering_outer_rect { + + if scrolling_enabled + && (is_hovering_outer_rect + || scroll_bar_visibility == ScrollBarVisibility::AlwaysVisible) + { + ui.ctx().create_scroll_delta(inner_rect); + let always_scroll_enabled_direction = ui.style().always_scroll_the_only_direction && scroll_enabled[0] != scroll_enabled[1]; for d in 0..2 { @@ -889,20 +895,19 @@ impl Prepared { if scrolling_up || scrolling_down { state.offset[d] -= scroll_delta; - - // Clear scroll delta so no parent scroll will use it: - ui.ctx().input_mut(|input| { - if always_scroll_enabled_direction { - input.smooth_scroll_delta[0] = 0.0; - input.smooth_scroll_delta[1] = 0.0; - } else { - input.smooth_scroll_delta[d] = 0.0; - } - }); - state.scroll_stuck_to_end[d] = false; state.offset_target[d] = None; } + + // Clear scroll delta so no parent scroll will use it: + ui.ctx().input_mut(|input| { + if always_scroll_enabled_direction { + input.smooth_scroll_delta[0] = 0.0; + input.smooth_scroll_delta[1] = 0.0; + } else { + input.smooth_scroll_delta[d] = 0.0; + } + }); } } } From 50f2a5beccc9669f2add9006c08d4d427ddb1770 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 25 Apr 2024 21:11:45 +0900 Subject: [PATCH 04/16] Update input_state.rs --- crates/egui/src/input_state.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 4232e6a9a77..29020ed9c9c 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -265,15 +265,19 @@ impl InputState { } let dt = self.stable_dt.at_most(0.1); - let _t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); // reach _% in _ seconds. TODO(emilk): parameterize + let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); // reach _% in _ seconds. TODO(emilk): parameterize for d in 0..2 { if self.unprocessed_scroll_delta[d].abs() < 1.0 { self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d]; self.unprocessed_scroll_delta[d] = 0.0; } else { - // let delta = t * self.unprocessed_scroll_delta[d]; // For Smooth - let delta = self.unprocessed_scroll_delta[d]; + let smooth_delta = t * self.unprocessed_scroll_delta[d]; // For Smooth + let direct_delta = self.unprocessed_scroll_delta[d]; // For Direct + let delta = match smooth_delta > 0.0 { + true => smooth_delta.min(direct_delta), // min : Smooth, max : Direct + false => smooth_delta.max(direct_delta), // max : Smooth, min : Direct + }; self.smooth_scroll_delta[d] += delta; self.unprocessed_scroll_delta[d] -= delta; } From 1ab53cf38a3870b00de342ca97fedab261bedc6b Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 25 Apr 2024 21:23:10 +0900 Subject: [PATCH 05/16] Update input_state.rs --- crates/egui/src/input_state.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 29020ed9c9c..79f6decc7e9 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -272,11 +272,11 @@ impl InputState { self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d]; self.unprocessed_scroll_delta[d] = 0.0; } else { - let smooth_delta = t * self.unprocessed_scroll_delta[d]; // For Smooth - let direct_delta = self.unprocessed_scroll_delta[d]; // For Direct + let smooth_delta = t * self.unprocessed_scroll_delta[d]; // For Smooth + let direct_delta = self.unprocessed_scroll_delta[d]; // For Direct let delta = match smooth_delta > 0.0 { - true => smooth_delta.min(direct_delta), // min : Smooth, max : Direct - false => smooth_delta.max(direct_delta), // max : Smooth, min : Direct + true => smooth_delta.min(direct_delta), // min : Smooth, max : Direct + false => smooth_delta.max(direct_delta), // max : Smooth, min : Direct }; self.smooth_scroll_delta[d] += delta; self.unprocessed_scroll_delta[d] -= delta; From f65f17b45594a97dfb3e5ed0a587d5c3965664cb Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 25 Apr 2024 22:22:34 +0900 Subject: [PATCH 06/16] Update input_state.rs --- crates/egui/src/input_state.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 79f6decc7e9..d7e1da2d378 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -272,11 +272,12 @@ impl InputState { self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d]; self.unprocessed_scroll_delta[d] = 0.0; } else { - let smooth_delta = t * self.unprocessed_scroll_delta[d]; // For Smooth - let direct_delta = self.unprocessed_scroll_delta[d]; // For Direct - let delta = match smooth_delta > 0.0 { - true => smooth_delta.min(direct_delta), // min : Smooth, max : Direct - false => smooth_delta.max(direct_delta), // max : Smooth, min : Direct + let smooth_delta = t * self.unprocessed_scroll_delta[d]; + let direct_delta = self.unprocessed_scroll_delta[d]; + // Smooth: smooth_delta > 0.0, Direct: smooth_delta < 0.0 + let delta = match smooth_delta < 0.0 { + true => smooth_delta.min(direct_delta), + false => smooth_delta.max(direct_delta), }; self.smooth_scroll_delta[d] += delta; self.unprocessed_scroll_delta[d] -= delta; From 3d81a443a08bc644fb28b6241511f419c115e373 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Fri, 26 Apr 2024 22:45:06 +0900 Subject: [PATCH 07/16] Update input_state.rs --- crates/egui/src/input_state.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index d7e1da2d378..ff01f047b50 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -251,15 +251,15 @@ impl InputState { } } - pub fn create_scroll_delta(&mut self, is_begin_frame: bool, is_pointer_contain: bool) { - if !is_begin_frame && !is_pointer_contain { + pub fn create_scroll_delta(&mut self, is_begin_frame: bool, is_contain_pointer: bool) { + if !is_begin_frame && !is_contain_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_pointer_contain { + if !is_begin_frame && is_contain_pointer { self.unprocessed_scroll_delta += self.raw_scroll_delta; self.raw_scroll_delta = Vec2::ZERO; } From 0bceb2f71e23f8a7fb49d200f7738a4f9ecfa00a Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Fri, 26 Apr 2024 23:39:43 +0900 Subject: [PATCH 08/16] Update input_state.rs --- crates/egui/src/input_state.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index ff01f047b50..3a45e102b3c 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -275,7 +275,7 @@ impl InputState { let smooth_delta = t * self.unprocessed_scroll_delta[d]; let direct_delta = self.unprocessed_scroll_delta[d]; // Smooth: smooth_delta > 0.0, Direct: smooth_delta < 0.0 - let delta = match smooth_delta < 0.0 { + let delta = match smooth_delta > 0.0 { true => smooth_delta.min(direct_delta), false => smooth_delta.max(direct_delta), }; From 122477b0d63c809914c25ce9135dfe314e71fbe3 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 28 Apr 2024 01:07:50 +0900 Subject: [PATCH 09/16] Update input_state.rs --- crates/egui/src/input_state.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 3a45e102b3c..85f509cc929 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -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; } @@ -275,7 +275,7 @@ impl InputState { let smooth_delta = t * self.unprocessed_scroll_delta[d]; let direct_delta = self.unprocessed_scroll_delta[d]; // Smooth: smooth_delta > 0.0, Direct: smooth_delta < 0.0 - let delta = match smooth_delta > 0.0 { + let delta = match smooth_delta < 0.0 { true => smooth_delta.min(direct_delta), false => smooth_delta.max(direct_delta), }; From 5827d52f25bd2f1593f6ca4b8a99f33574a2353d Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 28 Apr 2024 01:51:34 +0900 Subject: [PATCH 10/16] Update context.rs --- crates/egui/src/context.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 3755c9a0415..6f2c349d25a 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1081,8 +1081,8 @@ impl Context { pub(crate) fn create_scroll_delta(&self, inner_rect: Rect) { self.input_mut(|input| { let pointer_position = input.pointer.interact_pos().unwrap_or_default(); - let is_contain = inner_rect.contains(pointer_position); - input.create_scroll_delta(false, is_contain); + let is_contains_pointer = inner_rect.contains(pointer_position); + input.create_scroll_delta(false, is_contains_pointer); }); } From b8d1ed8686b4e9333a20ca025a15b024e389edcb Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 28 Apr 2024 02:05:32 +0900 Subject: [PATCH 11/16] Update context.rs --- crates/egui/src/context.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 6f2c349d25a..17409af1d85 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1078,6 +1078,9 @@ impl Context { .map_or(false, |response| response.contains_pointer) } + /// Create scroll delta + /// + /// See [`InputState`], [`ScrollArea`] pub(crate) fn create_scroll_delta(&self, inner_rect: Rect) { self.input_mut(|input| { let pointer_position = input.pointer.interact_pos().unwrap_or_default(); From 9f451c34c17973e430fb716c0f5add68c747f58b Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sat, 11 May 2024 21:48:05 +0900 Subject: [PATCH 12/16] Update input_state.rs --- crates/egui/src/input_state.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 85f509cc929..45488a95e77 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -275,7 +275,7 @@ impl InputState { let smooth_delta = t * self.unprocessed_scroll_delta[d]; let direct_delta = self.unprocessed_scroll_delta[d]; // Smooth: smooth_delta > 0.0, Direct: smooth_delta < 0.0 - let delta = match smooth_delta < 0.0 { + let delta = match smooth_delta > 0.0 { true => smooth_delta.min(direct_delta), false => smooth_delta.max(direct_delta), }; From baeaf99ccc810dafbd6662975a806dc412a49ed6 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 23 May 2024 23:13:33 +0900 Subject: [PATCH 13/16] Update input_state.rs --- crates/egui/src/input_state.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 6403bc3d0b4..6bb939cf81f 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -203,7 +203,7 @@ impl InputState { for touch_state in self.touch_states.values_mut() { touch_state.begin_frame(time, &new, self.pointer.interact_pos); } - let pointer = self.pointer.clone().begin_frame(time, &new); + let pointer = self.pointer.begin_frame(time, &new); let mut keys_down = self.keys_down; let mut zoom_factor_delta = 1.0; // TODO(emilk): smoothing for zoom factor From 06ad467ea37014d939d6c095b38c412eb85c68b6 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 23 May 2024 23:18:56 +0900 Subject: [PATCH 14/16] Update input_state.rs --- crates/egui/src/input_state.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 6bb939cf81f..c75a9b682fa 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -351,20 +351,22 @@ impl InputState { let dt = self.stable_dt.at_most(0.1); let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); - for d in 0..2 { - if self.unprocessed_scroll_delta[d].abs() < 1.0 { - self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d]; - self.unprocessed_scroll_delta[d] = 0.0; - } else { - let smooth_delta = t * self.unprocessed_scroll_delta[d]; - let direct_delta = self.unprocessed_scroll_delta[d]; - // Smooth: smooth_delta > 0.0, Direct: smooth_delta < 0.0 - let delta = match smooth_delta > 0.0 { - true => smooth_delta.min(direct_delta), - false => smooth_delta.max(direct_delta), - }; - self.smooth_scroll_delta[d] += delta; - self.unprocessed_scroll_delta[d] -= delta; + if self.unprocessed_scroll_delta != Vec2::ZERO { + for d in 0..2 { + if self.unprocessed_scroll_delta[d].abs() < 1.0 { + self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d]; + self.unprocessed_scroll_delta[d] = 0.0; + } else { + let smooth_delta = t * self.unprocessed_scroll_delta[d]; + let direct_delta = self.unprocessed_scroll_delta[d]; + // Smooth: smooth_delta > 0.0, Direct: smooth_delta < 0.0 + let applied = match smooth_delta < 0.0 { + true => smooth_delta.min(direct_delta), + false => smooth_delta.max(direct_delta), + }; + self.smooth_scroll_delta[d] += applied; + self.unprocessed_scroll_delta[d] -= applied; + } } } } From c397b129fb9559b87b5503cb08fd0060aa70e02d Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 23 May 2024 23:21:12 +0900 Subject: [PATCH 15/16] Update input_state.rs --- crates/egui/src/input_state.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index c75a9b682fa..4ad29c00e6a 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -348,10 +348,10 @@ impl InputState { self.raw_scroll_delta = Vec2::ZERO; } - let dt = self.stable_dt.at_most(0.1); - let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); - if self.unprocessed_scroll_delta != Vec2::ZERO { + let dt = self.stable_dt.at_most(0.1); + let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); + for d in 0..2 { if self.unprocessed_scroll_delta[d].abs() < 1.0 { self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d]; From 13365ad34df22ccb3945b9282de1e4eb72b10396 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 23 May 2024 23:21:59 +0900 Subject: [PATCH 16/16] Update input_state.rs --- crates/egui/src/input_state.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/input_state.rs b/crates/egui/src/input_state.rs index 4ad29c00e6a..17ae70ae274 100644 --- a/crates/egui/src/input_state.rs +++ b/crates/egui/src/input_state.rs @@ -351,7 +351,7 @@ impl InputState { if self.unprocessed_scroll_delta != Vec2::ZERO { let dt = self.stable_dt.at_most(0.1); let t = crate::emath::exponential_smooth_factor(0.90, 0.1, dt); - + for d in 0..2 { if self.unprocessed_scroll_delta[d].abs() < 1.0 { self.smooth_scroll_delta[d] += self.unprocessed_scroll_delta[d];