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

Method load_or_init_memory

egui_plot/src/plot.rs:883–924  ·  view source on GitHub ↗
(&self, ui: &Ui, plot_id: Id, plot_rect: Rect)

Source from the content-addressed store, hash-verified

881 }
882
883 fn load_or_init_memory(&self, ui: &Ui, plot_id: Id, plot_rect: Rect) -> PlotMemory {
884 // Load or initialize the memory.
885 ui.check_for_id_clash(plot_id, plot_rect, "Plot");
886
887 if self.reset {
888 if let Some((name, _)) = self.linked_axes.as_ref() {
889 ui.data_mut(|data| {
890 let link_groups: &mut BoundsLinkGroups = data.get_temp_mut_or_default(Id::NULL);
891 link_groups.0.remove(name);
892 });
893 }
894 PlotMemory {
895 auto_bounds: self.default_auto_bounds,
896 hovered_legend_item: None,
897 hidden_items: Default::default(),
898 transform: PlotTransform::new_with_invert_axis(
899 plot_rect,
900 self.min_auto_bounds,
901 self.center_axis,
902 Vec2b::new(self.invert_x, self.invert_y),
903 ),
904 last_click_pos_for_zoom: None,
905 x_axis_thickness: Default::default(),
906 y_axis_thickness: Default::default(),
907 }
908 } else {
909 PlotMemory::load(ui.ctx(), plot_id).unwrap_or_else(|| PlotMemory {
910 auto_bounds: self.default_auto_bounds,
911 hovered_legend_item: None,
912 hidden_items: Default::default(),
913 transform: PlotTransform::new_with_invert_axis(
914 plot_rect,
915 self.min_auto_bounds,
916 self.center_axis,
917 Vec2b::new(self.invert_x, self.invert_y),
918 ),
919 last_click_pos_for_zoom: None,
920 x_axis_thickness: Default::default(),
921 y_axis_thickness: Default::default(),
922 })
923 }
924 }
925
926 fn paint_background(&self, ui: &Ui, plot_rect: Rect) {
927 if self.show_background {

Callers 1

show_dynMethod · 0.80

Calls 1

ctxMethod · 0.80

Tested by

no test coverage detected