Fix set_plot_bounds (#2653)
This commit is contained in:
parent
660566c499
commit
212656f3fc
1 changed files with 6 additions and 1 deletions
|
@ -742,7 +742,7 @@ impl Plot {
|
|||
});
|
||||
|
||||
let PlotMemory {
|
||||
mut bounds_modified,
|
||||
bounds_modified,
|
||||
mut hovered_entry,
|
||||
mut hidden_items,
|
||||
last_screen_transform,
|
||||
|
@ -754,6 +754,7 @@ impl Plot {
|
|||
items: Vec::new(),
|
||||
next_auto_color_idx: 0,
|
||||
last_screen_transform,
|
||||
bounds_modified,
|
||||
response,
|
||||
ctx: ui.ctx().clone(),
|
||||
};
|
||||
|
@ -762,6 +763,7 @@ impl Plot {
|
|||
mut items,
|
||||
mut response,
|
||||
last_screen_transform,
|
||||
mut bounds_modified,
|
||||
..
|
||||
} = plot_ui;
|
||||
|
||||
|
@ -1042,6 +1044,7 @@ pub struct PlotUi {
|
|||
items: Vec<Box<dyn PlotItem>>,
|
||||
next_auto_color_idx: usize,
|
||||
last_screen_transform: ScreenTransform,
|
||||
bounds_modified: AxisBools,
|
||||
response: Response,
|
||||
ctx: Context,
|
||||
}
|
||||
|
@ -1069,11 +1072,13 @@ impl PlotUi {
|
|||
/// Set the plot bounds. Can be useful for implementing alternative plot navigation methods.
|
||||
pub fn set_plot_bounds(&mut self, plot_bounds: PlotBounds) {
|
||||
self.last_screen_transform.set_bounds(plot_bounds);
|
||||
self.bounds_modified = true.into();
|
||||
}
|
||||
|
||||
/// 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);
|
||||
self.bounds_modified = true.into();
|
||||
}
|
||||
|
||||
/// Returns `true` if the plot area is currently hovered.
|
||||
|
|
Loading…
Reference in a new issue