1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Add PlotUi::response() to replace plot_clicked() etc (#3223)

Closes https://github.com/emilk/egui/pull/2571
This commit is contained in:
Emil Ernerfeldt
2023-08-10 13:14:19 +02:00
committed by GitHub
parent b15e17587a
commit 66cbb61ad5
2 changed files with 9 additions and 1 deletions

View File

@@ -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()
}

View File

@@ -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(),
)
});