Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.22.0 #215

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,044 changes: 503 additions & 541 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "egui_graphs"
version = "0.21.1"
version = "0.22.0"
authors = ["Dmitrii Samsonov <[email protected]>"]
license = "MIT"
homepage = "https://github.com/blitzarx1/egui_graphs"
Expand All @@ -11,7 +11,7 @@ keywords = ["egui", "ui", "graph", "node-graph"]
categories = ["gui", "visualization"]

[dependencies]
egui = { version = "0.28", default-features = false }
egui = { version = "0.29", default-features = false }
rand = "0.8"
petgraph = { version = "0.6", default-features = false, features = [
"stable_graph",
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Combining this feature with custom node draw function allows to implement custom
### Persistence
To use egui `persistence` feature you need to enable `egui_persistence` feature of this crate. For example:
```toml
egui_graphs = { version = "0.21", features = ["egui_persistence"]}
egui = {version="0.23", features = ["persistence"]}
egui_graphs = { version = "0.22", features = ["egui_persistence"]}
egui = {version="0.29", features = ["persistence"]}
```

## Examples
Expand Down
4 changes: 2 additions & 2 deletions examples/animated_nodes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
4 changes: 2 additions & 2 deletions examples/basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
6 changes: 3 additions & 3 deletions examples/bevy_basic/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MIT"
edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
bevy = "0.14.2"
bevy_egui = "0.29.0"
egui_graphs = "0.21"
bevy = "0.14"
bevy_egui = "0.29"
petgraph = "0.6"
11 changes: 2 additions & 9 deletions examples/bevy_basic/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bevy::prelude::*;
use bevy_egui::{egui, EguiContexts, EguiPlugin};
use egui_graphs::{DefaultEdgeShape, DefaultNodeShape, Graph, GraphView};
use egui_graphs::{Graph, GraphView};
use petgraph::stable_graph::StableGraph;

fn main() {
Expand Down Expand Up @@ -46,13 +46,6 @@ fn update_graph(mut contexts: EguiContexts, mut q_graph: Query<&mut BasicGraph>)
let mut graph = q_graph.single_mut();

egui::CentralPanel::default().show(ctx, |ui| {
ui.add(&mut GraphView::<
_,
_,
_,
_,
DefaultNodeShape,
DefaultEdgeShape,
>::new(&mut graph.0));
ui.add(&mut GraphView::new(&mut graph.0));
});
}
4 changes: 2 additions & 2 deletions examples/demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../", features = ["events"] }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
serde_json = "1.0"
petgraph = "0.6"
fdg = { git = "https://github.com/grantshandy/fdg" }
Expand Down
4 changes: 2 additions & 2 deletions examples/demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use drawers::ValuesSectionDebug;
use eframe::{run_native, App, CreationContext};
use egui::{CollapsingHeader, Context, Pos2, ScrollArea, Ui, Vec2};
use egui_graphs::events::Event;
use egui_graphs::{to_graph, DefaultEdgeShape, DefaultNodeShape, Edge, Graph, GraphView, Node};
use egui_graphs::{to_graph, Edge, Graph, GraphView, Node};
use fdg::fruchterman_reingold::{FruchtermanReingold, FruchtermanReingoldConfiguration};
use fdg::nalgebra::{Const, OPoint};
use fdg::{Force, ForceGraph};
Expand Down Expand Up @@ -511,7 +511,7 @@ impl App for DemoApp {
let settings_style = &egui_graphs::SettingsStyle::new()
.with_labels_always(self.settings_style.labels_always);
ui.add(
&mut GraphView::<_, _, _, _, DefaultNodeShape, DefaultEdgeShape>::new(&mut self.g)
&mut GraphView::new(&mut self.g)
.with_interactions(settings_interaction)
.with_navigations(settings_navigation)
.with_styles(settings_style)
Expand Down
4 changes: 2 additions & 2 deletions examples/flex_nodes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
4 changes: 2 additions & 2 deletions examples/interactive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
6 changes: 2 additions & 4 deletions examples/interactive/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use eframe::{run_native, App, CreationContext};
use egui::Context;
use egui_graphs::{
DefaultEdgeShape, DefaultNodeShape, Graph, GraphView, SettingsInteraction, SettingsStyle,
};
use egui_graphs::{Graph, GraphView, SettingsInteraction, SettingsStyle};
use petgraph::stable_graph::StableGraph;

pub struct InteractiveApp {
Expand All @@ -29,7 +27,7 @@ impl App for InteractiveApp {
.with_edge_selection_multi_enabled(true);
let style_settings = &SettingsStyle::new().with_labels_always(true);
ui.add(
&mut GraphView::<_, _, _, _, DefaultNodeShape, DefaultEdgeShape>::new(&mut self.g)
&mut GraphView::new(&mut self.g)
.with_styles(style_settings)
.with_interactions(interaction_settings),
);
Expand Down
4 changes: 2 additions & 2 deletions examples/label_change/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
19 changes: 8 additions & 11 deletions examples/label_change/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use eframe::{run_native, App, CreationContext};
use egui::{CentralPanel, Context, SidePanel, TextEdit};
use egui_graphs::{
DefaultEdgeShape, DefaultNodeShape, Graph, GraphView, SettingsInteraction, SettingsStyle,
};
use egui_graphs::{Graph, GraphView, SettingsInteraction, SettingsStyle};
use petgraph::stable_graph::{EdgeIndex, NodeIndex, StableGraph};

pub struct LabelChangeApp {
Expand Down Expand Up @@ -54,14 +52,13 @@ impl LabelChangeApp {
}
});
CentralPanel::default().show(ctx, |ui| {
let widget =
&mut GraphView::<_, _, _, _, DefaultNodeShape, DefaultEdgeShape>::new(&mut self.g)
.with_interactions(
&SettingsInteraction::default()
.with_node_selection_enabled(true)
.with_edge_selection_enabled(true),
)
.with_styles(&SettingsStyle::default().with_labels_always(true));
let widget = &mut GraphView::new(&mut self.g)
.with_interactions(
&SettingsInteraction::default()
.with_node_selection_enabled(true)
.with_edge_selection_enabled(true),
)
.with_styles(&SettingsStyle::default().with_labels_always(true));
ui.add(widget);
});
}
Expand Down
4 changes: 2 additions & 2 deletions examples/multiple/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
75 changes: 35 additions & 40 deletions examples/multiple/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use eframe::{run_native, App, CreationContext, Frame};
use egui::{CentralPanel, Context, Layout, SidePanel};
use egui_graphs::{
DefaultEdgeShape, DefaultNodeShape, Graph, GraphView, SettingsInteraction, SettingsNavigation,
};
use egui_graphs::{Graph, GraphView, SettingsInteraction, SettingsNavigation};
use petgraph::stable_graph::StableGraph;

pub struct BasicApp {
Expand All @@ -23,52 +21,49 @@ impl App for BasicApp {
.default_width(available_width / 3.)
.resizable(true)
.show(ctx, |ui| {
ui.child_ui(ui.max_rect(), Layout::default(), None);
ui.add(
&mut GraphView::<_, _, _, _, DefaultNodeShape, DefaultEdgeShape>::new(
&mut self.g,
)
.with_navigations(
&SettingsNavigation::default()
.with_fit_to_screen_enabled(false)
.with_zoom_and_pan_enabled(true),
)
.with_interactions(
&SettingsInteraction::default()
.with_node_selection_multi_enabled(true)
.with_node_selection_enabled(true)
.with_edge_selection_enabled(true)
.with_edge_selection_multi_enabled(true)
.with_dragging_enabled(true),
),
)
ui.allocate_ui_with_layout(ui.max_rect().size(), Layout::default(), |ui| {
ui.add(
&mut GraphView::new(&mut self.g)
.with_navigations(
&SettingsNavigation::default()
.with_fit_to_screen_enabled(false)
.with_zoom_and_pan_enabled(true),
)
.with_interactions(
&SettingsInteraction::default()
.with_node_selection_multi_enabled(true)
.with_node_selection_enabled(true)
.with_edge_selection_enabled(true)
.with_edge_selection_multi_enabled(true)
.with_dragging_enabled(true),
),
);
});
});
SidePanel::right("right_panel")
.default_width(available_width / 3.)
.resizable(true)
.show(ctx, |ui| {
ui.add(
&mut GraphView::<_, _, _, _, DefaultNodeShape, DefaultEdgeShape>::new(
&mut self.g,
)
.with_navigations(
&SettingsNavigation::default()
.with_fit_to_screen_enabled(false)
.with_zoom_and_pan_enabled(true),
)
.with_interactions(
&SettingsInteraction::default()
.with_node_selection_multi_enabled(true)
.with_node_selection_enabled(true)
.with_edge_selection_enabled(true)
.with_edge_selection_multi_enabled(true)
.with_dragging_enabled(true),
),
&mut GraphView::new(&mut self.g)
.with_navigations(
&SettingsNavigation::default()
.with_fit_to_screen_enabled(false)
.with_zoom_and_pan_enabled(true),
)
.with_interactions(
&SettingsInteraction::default()
.with_node_selection_multi_enabled(true)
.with_node_selection_enabled(true)
.with_edge_selection_enabled(true)
.with_edge_selection_multi_enabled(true)
.with_dragging_enabled(true),
),
)
});
CentralPanel::default().show(ctx, |ui| {
ui.add(
&mut GraphView::<_, _, _, _, DefaultNodeShape, DefaultEdgeShape>::new(&mut self.g)
&mut GraphView::new(&mut self.g)
.with_navigations(
&SettingsNavigation::default()
.with_fit_to_screen_enabled(false)
Expand Down Expand Up @@ -104,7 +99,7 @@ fn generate_graph() -> StableGraph<(), ()> {
fn main() {
let native_options = eframe::NativeOptions::default();
run_native(
"egui_graphs_basic_demo",
"egui_graphs_multiple_demo",
native_options,
Box::new(|cc| Ok(Box::new(BasicApp::new(cc)))),
)
Expand Down
4 changes: 2 additions & 2 deletions examples/rainbow_edges/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
4 changes: 2 additions & 2 deletions examples/undirected/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
11 changes: 2 additions & 9 deletions examples/undirected/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use eframe::{run_native, App, CreationContext};
use egui::Context;
use egui_graphs::{DefaultEdgeShape, DefaultNodeShape, Graph, GraphView};
use egui_graphs::{Graph, GraphView};
use petgraph::{
stable_graph::{DefaultIx, StableGraph, StableUnGraph},
Undirected,
Expand All @@ -20,14 +20,7 @@ impl UndirectedApp {
impl App for UndirectedApp {
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.add(&mut GraphView::<
_,
_,
_,
_,
DefaultNodeShape,
DefaultEdgeShape,
>::new(&mut self.g));
ui.add(&mut GraphView::new(&mut self.g));
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/wasm_custom_draw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"

# Wasm related dependencies
Expand Down
4 changes: 2 additions & 2 deletions examples/window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../../" }
egui = "0.28"
eframe = "0.28"
egui = "0.29"
eframe = "0.29"
petgraph = "0.6"
11 changes: 2 additions & 9 deletions examples/window/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use eframe::{run_native, App, CreationContext};
use egui::{Context, Window};
use egui_graphs::{DefaultEdgeShape, DefaultNodeShape, Graph, GraphView};
use egui_graphs::{Graph, GraphView};
use petgraph::stable_graph::StableGraph;

pub struct WindowApp {
Expand All @@ -17,14 +17,7 @@ impl WindowApp {
impl App for WindowApp {
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
Window::new("graph").show(ctx, |ui| {
ui.add(&mut GraphView::<
_,
_,
_,
_,
DefaultNodeShape,
DefaultEdgeShape,
>::new(&mut self.g));
ui.add(&mut GraphView::new(&mut self.g));
});
}
}
Expand Down