From a1f6f6821366c95b36b43e83ba67bc7e8645e14a Mon Sep 17 00:00:00 2001 From: Andrew Langmeier Date: Thu, 13 Oct 2022 02:00:11 -0400 Subject: [PATCH] Allow for changing of plot bounds from PlotUI (#2145) --- crates/egui/src/widgets/plot/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/egui/src/widgets/plot/mod.rs b/crates/egui/src/widgets/plot/mod.rs index e9338428..a0d72dba 100644 --- a/crates/egui/src/widgets/plot/mod.rs +++ b/crates/egui/src/widgets/plot/mod.rs @@ -1040,6 +1040,11 @@ impl PlotUi { *self.last_screen_transform.bounds() } + /// Move the plot bounds. Can be useful for implementing alternative plot navigation methods. + pub fn translate_bounds(&mut self, delta_pos: Vec2) { + self.last_screen_transform.translate_bounds(delta_pos); + } + /// Returns `true` if the plot area is currently hovered. pub fn plot_hovered(&self) -> bool { self.response.hovered()