diff --git a/crates/egui/src/widgets/plot/mod.rs b/crates/egui/src/widgets/plot/mod.rs index 8f04be4f..9fa09b7e 100644 --- a/crates/egui/src/widgets/plot/mod.rs +++ b/crates/egui/src/widgets/plot/mod.rs @@ -1081,17 +1081,25 @@ impl PlotUi { .push(BoundsModification::Translate(delta_pos)); } + /// Can be used to check if the plot was hovered or clicked. + pub fn response(&self) -> &Response { + &self.response + } + /// Returns `true` if the plot area is currently hovered. + #[deprecated = "Use plot_ui.response().hovered()"] pub fn plot_hovered(&self) -> bool { self.response.hovered() } /// Returns `true` if the plot was clicked by the primary button. + #[deprecated = "Use plot_ui.response().clicked()"] pub fn plot_clicked(&self) -> bool { self.response.clicked() } /// Returns `true` if the plot was clicked by the secondary button. + #[deprecated = "Use plot_ui.response().secondary_clicked()"] pub fn plot_secondary_clicked(&self) -> bool { self.response.secondary_clicked() } diff --git a/crates/egui_demo_lib/src/demo/plot_demo.rs b/crates/egui_demo_lib/src/demo/plot_demo.rs index 8c5bcfd3..2f6180ea 100644 --- a/crates/egui_demo_lib/src/demo/plot_demo.rs +++ b/crates/egui_demo_lib/src/demo/plot_demo.rs @@ -761,7 +761,7 @@ impl InteractionDemo { plot_ui.pointer_coordinate(), plot_ui.pointer_coordinate_drag_delta(), plot_ui.plot_bounds(), - plot_ui.plot_hovered(), + plot_ui.response().hovered(), ) });