mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Reduce Plot::show code bloat by adding Plot::show_dyn
This commit is contained in:
@@ -489,6 +489,14 @@ impl Plot {
|
||||
|
||||
/// Interact with and add items to the plot and finally draw it.
|
||||
pub fn show<R>(self, ui: &mut Ui, build_fn: impl FnOnce(&mut PlotUi) -> R) -> InnerResponse<R> {
|
||||
self.show_dyn(ui, Box::new(build_fn))
|
||||
}
|
||||
|
||||
fn show_dyn<'a, R>(
|
||||
self,
|
||||
ui: &mut Ui,
|
||||
build_fn: Box<dyn FnOnce(&mut PlotUi) -> R + 'a>,
|
||||
) -> InnerResponse<R> {
|
||||
let Self {
|
||||
id_source,
|
||||
center_x_axis,
|
||||
|
||||
Reference in New Issue
Block a user