Skip to content

Commit

Permalink
Smooth scrolling in 2D space views
Browse files Browse the repository at this point in the history
When scrolling with a discreet mouse wheel,
the scrolling is now smoothed.
  • Loading branch information
emilk committed May 23, 2024
1 parent be6d679 commit b56f778
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions crates/re_space_view_spatial/src/ui_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,7 @@ fn ui_from_scene(

let mut pan_delta_in_ui = response.drag_delta();
if response.hovered() {
// NOTE: we use `raw_scroll` instead of `smooth_scroll_delta` to avoid the
// added latency of smoothing, which is really annoying on Mac trackpads.
// The smoothing is only useful for users with discreet scroll wheels,
// and they are likely to pan with dragging instead.
// TODO(egui#4401): https://github.com/emilk/egui/issues/4401
pan_delta_in_ui += response.ctx.input(|i| i.raw_scroll_delta);
pan_delta_in_ui += response.ctx.input(|i| i.smooth_scroll_delta);
}
if pan_delta_in_ui != Vec2::ZERO {
*visual_bounds =
Expand Down

0 comments on commit b56f778

Please sign in to comment.