MCPcopy Create free account
hub / github.com/emilk/egui_plot / show_controls

Method show_controls

examples/interaction/src/app.rs:60–94  ·  view source on GitHub ↗
(&self, ui: &mut egui::Ui)

Source from the content-addressed store, hash-verified

58 }
59
60 pub fn show_controls(&self, ui: &mut egui::Ui) -> Response {
61 if let Some(bounds) = &self.last_bounds {
62 ui.label(format!(
63 "plot bounds: min: {:.02?}, max: {:.02?}",
64 bounds.min(),
65 bounds.max()
66 ));
67 }
68
69 ui.label(format!(
70 "origin in screen coordinates: x: {:.02}, y: {:.02}",
71 self.last_screen_pos.x, self.last_screen_pos.y
72 ));
73 ui.label(format!("plot hovered: {}", self.last_hovered));
74 let coordinate_text = if let Some(coordinate) = self.last_pointer_coordinate {
75 format!("x: {:.02}, y: {:.02}", coordinate.x, coordinate.y)
76 } else {
77 "None".to_owned()
78 };
79 ui.label(format!("pointer coordinate: {coordinate_text}"));
80 let coordinate_text = format!(
81 "x: {:.02}, y: {:.02}",
82 self.last_pointer_drag_delta.x, self.last_pointer_drag_delta.y
83 );
84 ui.label(format!("pointer coordinate drag delta: {coordinate_text}"));
85
86 let hovered_item = if self.last_hovered_item == Some(egui::Id::new("sin")) {
87 "red sin"
88 } else if self.last_hovered_item == Some(egui::Id::new("cos")) {
89 "blue cos"
90 } else {
91 "none"
92 };
93 ui.label(format!("hovered plot item: {hovered_item}"))
94 }
95}

Callers

nothing calls this directly

Calls 1

labelMethod · 0.80

Tested by

no test coverage detected