Struct egui_graphs::GraphView
source · pub struct GraphView<'a, N: Clone, E: Clone, Ty: EdgeType> { /* private fields */ }Expand description
Widget for visualizing and interacting with graphs.
It implements egui::Widget and can be used like any other widget.
The widget uses a mutable reference to the [StableGraph<egui_graphs::NodeN and E is arbitrary client data associated with nodes and edges.
You can customize the visualization and interaction behavior using SettingsInteraction, SettingsNavigation and SettingsStyle structs.
When any interaction or node property change occurs, the widget sends Change struct to the provided
[Senderwith_interactions method. The Change struct contains information about
a change that occurred in the graph. Client can use this information to modify external state of his application if needed.
When the user performs navigation actions (zoom & pan, fit to screen), they do not produce changes. This is because these actions are performed on the global coordinates and do not change any properties of the nodes or edges.
Implementations§
source§impl<'a, N: Clone, E: Clone, Ty: EdgeType> GraphView<'a, N, E, Ty>
impl<'a, N: Clone, E: Clone, Ty: EdgeType> GraphView<'a, N, E, Ty>
sourcepub fn new(g: &'a mut Graph<N, E, Ty>) -> Self
pub fn new(g: &'a mut Graph<N, E, Ty>) -> Self
Creates a new GraphView widget with default navigation and interactions settings.
To customize navigation and interactions use with_interactions and with_navigations methods.
sourcepub fn with_interactions(
self,
settings_interaction: &SettingsInteraction
) -> Self
pub fn with_interactions( self, settings_interaction: &SettingsInteraction ) -> Self
Makes widget interactive according to the provided settings.
sourcepub fn with_changes(self, changes_sender: &'a Sender<Change>) -> Self
pub fn with_changes(self, changes_sender: &'a Sender<Change>) -> Self
Make every interaction send Change to the provided [crossbeam::channel::Sender] as soon as interaction happens.
Change events can be used to handle interactions on the application side.
Modifies default behaviour of navigation settings.
sourcepub fn with_styles(self, settings_style: &SettingsStyle) -> Self
pub fn with_styles(self, settings_style: &SettingsStyle) -> Self
Modifies default style settings.
sourcepub fn reset_metadata(ui: &mut Ui)
pub fn reset_metadata(ui: &mut Ui)
Resets navigation metadata