Skip to content

Commit

Permalink
Merge pull request #223 from rerun-io/emilk/fix-scroll-to-pan
Browse files Browse the repository at this point in the history
Fix: only scroll-to-pan if hovering the map view
  • Loading branch information
podusowski authored Nov 8, 2024
2 parents 51bd82e + 5b7c3bf commit f870883
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions walkers/src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,17 @@ impl Map<'_, '_, '_> {
.recalculate_drag(response, self.my_position);
}

// Panning by scrolling, e.g. two-finger drag on a touchpad:
let scroll_delta = ui.input(|i| i.smooth_scroll_delta);
if scroll_delta != Vec2::ZERO {
let pos = self
.memory
.center_mode
.position(self.my_position, self.memory.zoom());
self.memory.center_mode =
Center::Exact(AdjustedPosition::from(pos).shift(scroll_delta));
if ui.ui_contains_pointer() {
// Panning by scrolling, e.g. two-finger drag on a touchpad:
let scroll_delta = ui.input(|i| i.smooth_scroll_delta);
if scroll_delta != Vec2::ZERO {
let pos = self
.memory
.center_mode
.position(self.my_position, self.memory.zoom());
self.memory.center_mode =
Center::Exact(AdjustedPosition::from(pos).shift(scroll_delta));
}
}

changed
Expand Down

0 comments on commit f870883

Please sign in to comment.