mirror of
https://github.com/emilk/egui.git
synced 2026-09-03 07:10:04 -04:00
Add PlotUi::response() to replace plot_clicked() etc (#3223)
Closes https://github.com/emilk/egui/pull/2571
This commit is contained in:
@@ -1081,17 +1081,25 @@ impl PlotUi {
|
|||||||
.push(BoundsModification::Translate(delta_pos));
|
.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.
|
/// Returns `true` if the plot area is currently hovered.
|
||||||
|
#[deprecated = "Use plot_ui.response().hovered()"]
|
||||||
pub fn plot_hovered(&self) -> bool {
|
pub fn plot_hovered(&self) -> bool {
|
||||||
self.response.hovered()
|
self.response.hovered()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the plot was clicked by the primary button.
|
/// Returns `true` if the plot was clicked by the primary button.
|
||||||
|
#[deprecated = "Use plot_ui.response().clicked()"]
|
||||||
pub fn plot_clicked(&self) -> bool {
|
pub fn plot_clicked(&self) -> bool {
|
||||||
self.response.clicked()
|
self.response.clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `true` if the plot was clicked by the secondary button.
|
/// 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 {
|
pub fn plot_secondary_clicked(&self) -> bool {
|
||||||
self.response.secondary_clicked()
|
self.response.secondary_clicked()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -761,7 +761,7 @@ impl InteractionDemo {
|
|||||||
plot_ui.pointer_coordinate(),
|
plot_ui.pointer_coordinate(),
|
||||||
plot_ui.pointer_coordinate_drag_delta(),
|
plot_ui.pointer_coordinate_drag_delta(),
|
||||||
plot_ui.plot_bounds(),
|
plot_ui.plot_bounds(),
|
||||||
plot_ui.plot_hovered(),
|
plot_ui.response().hovered(),
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user