Skip to content

Commit e96ea92

Browse files
chore: bump egui 0.33 -> 0.34.1 (#307)
Co-authored-by: Dmitrii Samsonov <blitzar90@gmail.com>
1 parent 943ff27 commit e96ea92

16 files changed

Lines changed: 80 additions & 140 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@ struct_excessive_bools = { level = "allow", priority = 13 }
3333
return_self_not_must_use = { level = "allow", priority = 14 }
3434

3535
[workspace.dependencies]
36-
egui = { version = "0.33", default-features = false }
37-
eframe = "0.33"
38-
egui_extras = { version = "0.33", default-features = false }
36+
egui = { version = "0.34.1", default-features = false }
37+
eframe = "0.34.1"
38+
egui_extras = { version = "0.34.1", default-features = false }
3939
petgraph = { version = "0.8", default-features = false }
4040
serde = "1.0"
4141
serde_json = "1.0"
4242
rand = "0.9"
4343
web-time = "1.1"
4444
crossbeam = "0.8"
45-
bevy = "0.17"
46-
bevy_egui = "0.38"
4745
ureq = { version = "3", default-features = true }
4846
criterion = { version = "0.7", features = ["html_reports"] }

crates/demo-core/src/lib.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl DemoApp {
201201
events_buf,
202202
#[cfg(feature = "events")]
203203
event_filters: EventFilters::default(),
204-
dark_mode: cc.egui_ctx.style().visuals.dark_mode,
204+
dark_mode: cc.egui_ctx.global_style().visuals.dark_mode,
205205
show_debug_overlay: true,
206206
show_keybindings_overlay: false,
207207
keybindings_just_opened: false,
@@ -450,7 +450,7 @@ impl DemoApp {
450450
egui_graphs::reset::<FruchtermanReingoldWithCenterGravityState>(ui, None);
451451
egui_graphs::reset::<LayoutStateHierarchical>(ui, None);
452452
ui.ctx().set_visuals(egui::Visuals::dark());
453-
self.dark_mode = ui.ctx().style().visuals.dark_mode;
453+
self.dark_mode = ui.ctx().global_style().visuals.dark_mode;
454454
#[cfg(feature = "events")]
455455
{
456456
self.last_events.clear();
@@ -910,7 +910,7 @@ impl DemoApp {
910910
pub fn ui_style(&mut self, ui: &mut Ui) {
911911
CollapsingHeader::new("Style").show(ui, |ui| {
912912
ui.horizontal(|ui| {
913-
let mut dark = ui.ctx().style().visuals.dark_mode;
913+
let mut dark = ui.ctx().global_style().visuals.dark_mode;
914914
if ui
915915
.checkbox(&mut dark, "dark mode")
916916
.on_hover_text("Toggle dark or light visuals")
@@ -1154,21 +1154,21 @@ impl DemoApp {
11541154
}
11551155

11561156
impl App for DemoApp {
1157-
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
1157+
fn ui(&mut self, ui: &mut Ui, _: &mut eframe::Frame) {
11581158
// Reset typing flag each frame; UI code will set it when a text field has focus
11591159
self.typing_in_input = false;
11601160
// Sync counts displayed on sliders with actual graph values
11611161
self.sync_counts();
11621162

11631163
// Handle global keyboard shortcuts and modal toggling
1164-
self.process_keybindings(ctx);
1164+
self.process_keybindings(ui.ctx());
11651165

11661166
// Right side panel with controls
11671167
if self.show_sidebar {
1168-
egui::SidePanel::right("right")
1169-
.default_width(SIDE_PANEL_WIDTH)
1170-
.min_width(SIDE_PANEL_WIDTH)
1171-
.show(ctx, |ui| {
1168+
egui::Panel::right("right")
1169+
.default_size(SIDE_PANEL_WIDTH)
1170+
.min_size(SIDE_PANEL_WIDTH)
1171+
.show_inside(ui, |ui| {
11721172
// Tabs header using selectable labels
11731173
ui.horizontal(|ui| {
11741174
ui.selectable_value(
@@ -1189,7 +1189,7 @@ impl App for DemoApp {
11891189
}
11901190

11911191
// Central graph view
1192-
egui::CentralPanel::default().show(ctx, |ui| {
1192+
egui::CentralPanel::default().show_inside(ui, |ui| {
11931193
if self.reset_requested {
11941194
self.reset_all(ui);
11951195
self.reset_requested = false;
@@ -1199,12 +1199,12 @@ impl App for DemoApp {
11991199
// Detect if any file is being dragged over the app. Some platforms/browsers
12001200
// don't provide a pointer position during file drags, so don't require it.
12011201
// We draw the overlay only within the CentralPanel rect anyway.
1202-
self.drag_hover_graph = ctx.input(|i| !i.raw.hovered_files.is_empty());
1202+
self.drag_hover_graph = ui.ctx().input(|i| !i.raw.hovered_files.is_empty());
12031203

12041204
// Handle drops this frame (platform may provide bytes immediately or later). Process the first valid one.
12051205
let mut maybe_text: Option<String> = None;
12061206
let mut maybe_name: Option<String> = None;
1207-
ctx.input(|i| {
1207+
ui.ctx().input(|i| {
12081208
for f in &i.raw.dropped_files {
12091209
if let Some(bytes) = &f.bytes {
12101210
if let Ok(s) = std::str::from_utf8(bytes) {
@@ -1567,7 +1567,7 @@ impl App for DemoApp {
15671567
self.update_fps();
15681568

15691569
// Draw modal after main UI
1570-
self.keybindings_modal(ctx);
1570+
self.keybindings_modal(ui.ctx());
15711571
}
15721572
}
15731573

@@ -1845,7 +1845,7 @@ impl DemoApp {
18451845
}
18461846

18471847
// Other keybindings (still disabled while typing to avoid graph actions while editing text)
1848-
let typing = self.typing_in_input || ctx.wants_keyboard_input();
1848+
let typing = self.typing_in_input || ctx.egui_wants_keyboard_input();
18491849
let cmds = if typing {
18501850
Vec::new()
18511851
} else {

crates/egui_graphs/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ events = ["dep:crossbeam", "demo-core/events"]
3333

3434
[dev-dependencies]
3535
eframe.workspace = true
36-
bevy.workspace = true
37-
bevy_egui.workspace = true
3836
serde_json.workspace = true
3937
ureq = { workspace = true, default-features = true, features = ["json"] }
4038
criterion = { workspace = true, features = ["html_reports"] }
@@ -47,4 +45,4 @@ harness = false
4745

4846
[target.'cfg(target_arch = "wasm32")'.dependencies]
4947
# Enable JS RNG source for all wasm dependents via feature unification.
50-
getrandom = { version = "0.2", features = ["js"] }
48+
getrandom = { version = "0.2", features = ["js"] }

crates/egui_graphs/examples/animated_nodes.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use eframe::{run_native, App, CreationContext};
2-
use egui::Context;
32
use egui_graphs::{
43
default_edge_transform, default_node_transform, to_graph_custom, DefaultEdgeShape, Graph,
54
GraphView, SettingsInteraction, SettingsNavigation,
@@ -39,8 +38,8 @@ impl AnimatedNodesApp {
3938
}
4039

4140
impl App for AnimatedNodesApp {
42-
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
43-
egui::CentralPanel::default().show(ctx, |ui| {
41+
fn ui(&mut self, ui: &mut egui::Ui, _: &mut eframe::Frame) {
42+
egui::CentralPanel::default().show_inside(ui, |ui| {
4443
ui.add(
4544
&mut GraphView::<_, _, _, _, NodeShapeAnimated, DefaultEdgeShape>::new(&mut self.g)
4645
.with_navigations(
@@ -180,7 +179,7 @@ mod node {
180179
let center = ctx.meta.canvas_to_screen_pos(self.loc);
181180
let size = ctx.meta.canvas_to_screen_size(self.size);
182181
let rect_default = Rect::from_center_size(center, Vec2::new(size, size));
183-
let color = ctx.ctx.style().visuals.weak_text_color();
182+
let color = ctx.ctx.global_style().visuals.weak_text_color();
184183

185184
let diff = if self.dragged {
186185
self.get_rotation_increment()
@@ -206,7 +205,7 @@ mod node {
206205
Shape::convex_polygon(points, Color32::default(), Stroke::new(1., color));
207206

208207
// create label
209-
let color = ctx.ctx.style().visuals.text_color();
208+
let color = ctx.ctx.global_style().visuals.text_color();
210209
let galley = ctx.ctx.fonts_mut(|f| {
211210
f.layout_no_wrap(
212211
self.label.clone(),

crates/egui_graphs/examples/basic.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use eframe::{run_native, App, CreationContext, NativeOptions};
2-
use egui::Context;
32
use egui_graphs::{DefaultGraphView, Graph};
43
use petgraph::stable_graph::StableGraph;
54

@@ -15,8 +14,8 @@ impl BasicApp {
1514
}
1615

1716
impl App for BasicApp {
18-
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
19-
egui::CentralPanel::default().show(ctx, |ui| {
17+
fn ui(&mut self, ui: &mut egui::Ui, _: &mut eframe::Frame) {
18+
egui::CentralPanel::default().show_inside(ui, |ui| {
2019
ui.add(&mut DefaultGraphView::new(&mut self.g));
2120
});
2221
}

crates/egui_graphs/examples/basic_custom.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use eframe::{run_native, App, CreationContext, NativeOptions};
2-
use egui::{Context, Pos2};
2+
use egui::Pos2;
33
use egui_graphs::{DefaultGraphView, Graph, SettingsStyle};
44
use petgraph::stable_graph::StableGraph;
55

@@ -28,8 +28,8 @@ impl BasicCustomApp {
2828
}
2929

3030
impl App for BasicCustomApp {
31-
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
32-
egui::CentralPanel::default().show(ctx, |ui| {
31+
fn ui(&mut self, ui: &mut egui::Ui, _: &mut eframe::Frame) {
32+
egui::CentralPanel::default().show_inside(ui, |ui| {
3333
ui.add(
3434
&mut DefaultGraphView::new(&mut self.g)
3535
.with_styles(&SettingsStyle::default().with_labels_always(true)),

crates/egui_graphs/examples/bevy.rs

Lines changed: 0 additions & 42 deletions
This file was deleted.

crates/egui_graphs/examples/flex_nodes.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use eframe::{run_native, App, CreationContext};
2-
use egui::{CentralPanel, Context, SidePanel, TextEdit};
2+
use egui::{CentralPanel, Panel, TextEdit};
33
use egui_graphs::{generate_simple_digraph, Graph, GraphView, SettingsInteraction};
44
use node::NodeShapeFlex;
55
use petgraph::{
@@ -40,8 +40,8 @@ impl FlexNodesApp {
4040
}
4141
}
4242

43-
fn render(&mut self, ctx: &Context) {
44-
SidePanel::right("right_panel").show(ctx, |ui| {
43+
fn render(&mut self, ui: &mut egui::Ui) {
44+
Panel::right("right_panel").show_inside(ui, |ui| {
4545
ui.label("Select a node to change its label");
4646
ui.add_enabled_ui(
4747
self.selected_node.is_some() || self.selected_edge.is_some(),
@@ -55,7 +55,7 @@ impl FlexNodesApp {
5555
self.reset(ui);
5656
}
5757
});
58-
CentralPanel::default().show(ctx, |ui| {
58+
CentralPanel::default().show_inside(ui, |ui| {
5959
let widget = &mut GraphView::<_, _, _, _, _, _>::new(&mut self.g).with_interactions(
6060
&SettingsInteraction::default().with_node_selection_enabled(true),
6161
);
@@ -68,26 +68,24 @@ impl FlexNodesApp {
6868
return;
6969
}
7070

71-
if self.selected_node.is_some() {
72-
let idx = self.selected_node.unwrap();
73-
if idx.index().to_string() == self.label_input {
71+
if let Some(node_index) = self.selected_node {
72+
if node_index.index().to_string() == self.label_input {
7473
return;
7574
}
7675

7776
self.g
78-
.node_mut(idx)
77+
.node_mut(node_index)
7978
.unwrap()
8079
.set_label(self.label_input.clone());
8180
}
8281

83-
if self.selected_edge.is_some() {
84-
let idx = self.selected_edge.unwrap();
85-
if idx.index().to_string() == self.label_input {
82+
if let Some(edge_index) = self.selected_edge {
83+
if edge_index.index().to_string() == self.label_input {
8684
return;
8785
}
8886

8987
self.g
90-
.edge_mut(idx)
88+
.edge_mut(edge_index)
9189
.unwrap()
9290
.set_label(self.label_input.clone());
9391
}
@@ -107,9 +105,9 @@ impl FlexNodesApp {
107105
}
108106

109107
impl App for FlexNodesApp {
110-
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
108+
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
111109
self.read_data();
112-
self.render(ctx);
110+
self.render(ui);
113111
self.update_data();
114112
}
115113
}
@@ -164,7 +162,7 @@ mod node {
164162
fn shapes(&mut self, ctx: &egui_graphs::DrawContext) -> Vec<egui::Shape> {
165163
// find node center location on the screen coordinates
166164
let center = ctx.meta.canvas_to_screen_pos(self.loc);
167-
let color = ctx.ctx.style().visuals.text_color();
165+
let color = ctx.ctx.global_style().visuals.text_color();
168166

169167
// create label
170168
let galley = ctx.ctx.fonts_mut(|f| {

crates/egui_graphs/examples/label_change.rs

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use eframe::{run_native, App, CreationContext};
2-
use egui::{CentralPanel, Context, SidePanel, TextEdit};
2+
use egui::{CentralPanel, Panel, TextEdit};
33
use egui_graphs::{
44
generate_simple_digraph, DefaultGraphView, Graph, SettingsInteraction, SettingsStyle,
55
};
@@ -38,8 +38,8 @@ impl LabelChangeApp {
3838
}
3939
}
4040

41-
fn render(&mut self, ctx: &Context) {
42-
SidePanel::right("right_panel").show(ctx, |ui| {
41+
fn render(&mut self, ui: &mut egui::Ui) {
42+
Panel::right("right_panel").show_inside(ui, |ui| {
4343
ui.label("Change Label");
4444
ui.add_enabled_ui(
4545
self.selected_node.is_some() || self.selected_edge.is_some(),
@@ -53,7 +53,7 @@ impl LabelChangeApp {
5353
self.reset(ui);
5454
}
5555
});
56-
CentralPanel::default().show(ctx, |ui| {
56+
CentralPanel::default().show_inside(ui, |ui| {
5757
let widget = &mut DefaultGraphView::new(&mut self.g)
5858
.with_interactions(
5959
&SettingsInteraction::default()
@@ -70,26 +70,24 @@ impl LabelChangeApp {
7070
return;
7171
}
7272

73-
if self.selected_node.is_some() {
74-
let idx = self.selected_node.unwrap();
75-
if idx.index().to_string() == self.label_input {
73+
if let Some(node_index) = self.selected_node {
74+
if node_index.index().to_string() == self.label_input {
7675
return;
7776
}
7877

7978
self.g
80-
.node_mut(idx)
79+
.node_mut(node_index)
8180
.unwrap()
8281
.set_label(self.label_input.clone());
8382
}
8483

85-
if self.selected_edge.is_some() {
86-
let idx = self.selected_edge.unwrap();
87-
if idx.index().to_string() == self.label_input {
84+
if let Some(edge_index) = self.selected_edge {
85+
if edge_index.index().to_string() == self.label_input {
8886
return;
8987
}
9088

9189
self.g
92-
.edge_mut(idx)
90+
.edge_mut(edge_index)
9391
.unwrap()
9492
.set_label(self.label_input.clone());
9593
}
@@ -109,9 +107,9 @@ impl LabelChangeApp {
109107
}
110108

111109
impl App for LabelChangeApp {
112-
fn update(&mut self, ctx: &Context, _: &mut eframe::Frame) {
110+
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
113111
self.read_data();
114-
self.render(ctx);
112+
self.render(ui);
115113
self.update_data();
116114
}
117115
}

0 commit comments

Comments
 (0)