mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Prevent plot from resetting one axis while zooming/dragging the other (#4252)
* Closes <https://github.com/emilk/egui/issues/4251>
This commit is contained in:
committed by
Emil Ernerfeldt
parent
11c5cb09e9
commit
cadaa7a65d
@@ -1021,7 +1021,7 @@ impl Plot {
|
|||||||
delta.y = 0.0;
|
delta.y = 0.0;
|
||||||
}
|
}
|
||||||
mem.transform.translate_bounds(delta);
|
mem.transform.translate_bounds(delta);
|
||||||
mem.auto_bounds = !allow_drag;
|
mem.auto_bounds = mem.auto_bounds.and(!allow_drag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zooming
|
// Zooming
|
||||||
@@ -1097,7 +1097,7 @@ impl Plot {
|
|||||||
}
|
}
|
||||||
if zoom_factor != Vec2::splat(1.0) {
|
if zoom_factor != Vec2::splat(1.0) {
|
||||||
mem.transform.zoom(zoom_factor, hover_pos);
|
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() {
|
if allow_scroll.any() {
|
||||||
|
|||||||
Reference in New Issue
Block a user