Skip to content

Commit

Permalink
Prevent plot from resetting one axis while zooming/dragging the other…
Browse files Browse the repository at this point in the history
… (#4252)

* Closes <emilk/egui#4251>
  • Loading branch information
YgorSouza authored Mar 28, 2024
1 parent b451f12 commit 2d5d728
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/egui_plot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ impl Plot {
delta.y = 0.0;
}
mem.transform.translate_bounds(delta);
mem.auto_bounds = !allow_drag;
mem.auto_bounds = mem.auto_bounds.and(!allow_drag);
}

// Zooming
Expand Down Expand Up @@ -1092,7 +1092,7 @@ impl Plot {
}
if zoom_factor != Vec2::splat(1.0) {
mem.transform.zoom(zoom_factor, hover_pos);
mem.auto_bounds = !allow_zoom;
mem.auto_bounds = mem.auto_bounds.and(!allow_zoom);
}
}
if allow_scroll.any() {
Expand Down

0 comments on commit 2d5d728

Please sign in to comment.