Skip to content

Bump egui to 0.31 (and rand to 0.9) #232

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
415 changes: 274 additions & 141 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
Expand Up @@ -11,10 +11,10 @@ keywords = ["egui", "ui", "graph", "node-graph"]
categories = ["gui", "visualization"]

[dependencies]
egui = { version = "0.30.0", default-features = false, features = [
egui = { version = "0.31.0", default-features = false, features = [
"persistence",
] }
rand = "0.8"
rand = "0.9"
petgraph = { version = "0.6", default-features = false, features = [
"stable_graph",
"matrix_graph",
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
4 changes: 2 additions & 2 deletions examples/basic_custom/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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
6 changes: 3 additions & 3 deletions examples/demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../..", features = ["events"] }
egui = "0.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
serde_json = "1.0"
petgraph = "0.6"
fdg = { git = "https://github.com/grantshandy/fdg" }
rand = "0.8"
rand = "0.9"
crossbeam = "0.8"
10 changes: 5 additions & 5 deletions examples/demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl DemoApp {
return None;
}

let random_n_idx = rand::thread_rng().gen_range(0..nodes_cnt);
let random_n_idx = rand::rng().random_range(0..nodes_cnt);
self.g.g.node_indices().nth(random_n_idx)
}

Expand All @@ -160,7 +160,7 @@ impl DemoApp {
return None;
}

let random_e_idx = rand::thread_rng().gen_range(0..edges_cnt);
let random_e_idx = rand::rng().random_range(0..edges_cnt);
self.g.g.edge_indices().nth(random_e_idx)
}

Expand All @@ -178,10 +178,10 @@ impl DemoApp {
let random_n = self.g.node(random_n_idx.unwrap()).unwrap();

// location of new node is in in the closest surrounding of random existing node
let mut rng = rand::thread_rng();
let mut rng = rand::rng();
let location = Pos2::new(
random_n.location().x + 10. + rng.gen_range(0. ..50.),
random_n.location().y + 10. + rng.gen_range(0. ..50.),
random_n.location().x + 10. + rng.random_range(0. ..50.),
random_n.location().y + 10. + rng.random_range(0. ..50.),
);

let g_idx = self.g.add_node_with_location((), location);
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
4 changes: 2 additions & 2 deletions examples/layouts/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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
6 changes: 3 additions & 3 deletions examples/wasm_custom_draw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ edition = "2021"

[dependencies]
egui_graphs = { path = "../.." }
egui = "0.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"

# Wasm related dependencies
getrandom = { version = "0.2", features = ["js"] }
getrandom = { version = "0.3.1", features = ["wasm_js"] }
log = "0.4"
instant = { version = "0.1", features = ["wasm-bindgen"] }

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.30"
eframe = "0.30"
egui = "0.31"
eframe = "0.31"
petgraph = "0.6"
6 changes: 3 additions & 3 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,16 @@ pub fn node_size<N: Clone, E: Clone, Ty: EdgeType, Ix: IndexType, D: DisplayNode
}

pub fn random_graph(num_nodes: usize, num_edges: usize) -> Graph {
let mut rng = rand::thread_rng();
let mut rng = rand::rng();
let mut graph = StableGraph::new();

for _ in 0..num_nodes {
graph.add_node(());
}

for _ in 0..num_edges {
let source = rng.gen_range(0..num_nodes);
let target = rng.gen_range(0..num_nodes);
let source = rng.random_range(0..num_nodes);
let target = rng.random_range(0..num_nodes);

graph.add_edge(NodeIndex::new(source), NodeIndex::new(target), ());
}
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/random/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ impl Layout<State> for Random {
return;
}

let mut rng = rand::thread_rng();
let mut rng = rand::rng();
for node in g.g.node_weights_mut() {
node.set_layout_location(Pos2::new(
rng.gen_range(0. ..SPAWN_SIZE),
rng.gen_range(0. ..SPAWN_SIZE),
rng.random_range(0. ..SPAWN_SIZE),
rng.random_range(0. ..SPAWN_SIZE),
));
}

Expand Down