diff --git a/examples/ui/ui.rs b/examples/ui/ui.rs index 5f7d2fd6f3a4e9..08d5a710f9dfc6 100644 --- a/examples/ui/ui.rs +++ b/examples/ui/ui.rs @@ -316,8 +316,8 @@ fn mouse_scroll( MouseScrollUnit::Line => mouse_wheel_event.y * 20., MouseScrollUnit::Pixel => mouse_wheel_event.y, }; - scrolling_list.position -= dy; - scrolling_list.position = scrolling_list.position.clamp(0., max_scroll); + scrolling_list.position += dy; + scrolling_list.position = scrolling_list.position.clamp(-max_scroll, 0.); style.position.top = Val::Px(scrolling_list.position); } }