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:
parent
3dba73e63e
commit
c4f16af721
|
|
@ -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
|
||||||
|
|
@ -1092,7 +1092,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() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue