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

Method show_legend_and_update_memory

egui_plot/src/plot.rs:976–990  ·  view source on GitHub ↗

Show legend widget and update memory with legend state.

(
        legend: Option<LegendWidget>,
        ui: &mut Ui,
        mem: &mut PlotMemory,
        hovered_plot_item: &mut Option<Id>,
    )

Source from the content-addressed store, hash-verified

974
975 /// Show legend widget and update memory with legend state.
976 fn show_legend_and_update_memory(
977 legend: Option<LegendWidget>,
978 ui: &mut Ui,
979 mem: &mut PlotMemory,
980 hovered_plot_item: &mut Option<Id>,
981 ) {
982 if let Some(mut legend) = legend {
983 ui.add(&mut legend);
984 mem.hidden_items = legend.hidden_items();
985 mem.hovered_legend_item = legend.hovered_item();
986 if let Some(item_id) = &mem.hovered_legend_item {
987 hovered_plot_item.get_or_insert(*item_id);
988 }
989 }
990 }
991
992 fn compute_bounds(&self, ui: &Ui, mem: &mut PlotMemory, plot_ui: &PlotUi<'a>, plot_rect: Rect) {
993 // Find the cursors from other plots we need to draw

Callers

nothing calls this directly

Calls 3

addMethod · 0.80
hidden_itemsMethod · 0.80
hovered_itemMethod · 0.80

Tested by

no test coverage detected