Skip to content

Commit be9bedf

Browse files
Adanos020hydra
andauthored
Update egui to 0.31 (#259) (#260)
* Update egui to 0.31 * Fix clippy warning and prepare for release * Fix docs --------- Co-authored-by: Dominic Clifton <[email protected]>
1 parent 951a656 commit be9bedf

File tree

9 files changed

+109
-98
lines changed

9 files changed

+109
-98
lines changed

Diff for: CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# egui_dock changelog
22

3-
## 0.15.0 - 2024-12-28
3+
## egui_dock 0.16.0 - 2025-02-07
4+
5+
### Breaking changes
6+
7+
- Upgraded to egui 0.31.
8+
9+
## egui_dock 0.15.0 - 2024-12-28
410

511
### Changed
612

Diff for: Cargo.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name = "egui_dock"
33
description = "Docking system for egui - an immediate-mode GUI library for Rust"
44
authors = ["lain-dono", "Adam Gąsior (Adanos020)"]
5-
version = "0.15.0"
5+
version = "0.16.0"
66
edition = "2021"
7-
rust-version = "1.76"
7+
rust-version = "1.81"
88
license = "MIT"
99
readme = "README.md"
1010
repository = "https://github.com/Adanos020/egui_dock"
@@ -18,14 +18,14 @@ default = []
1818
serde = ["dep:serde", "egui/serde"]
1919

2020
[dependencies]
21-
egui = { version = "0.30", default-features = false }
21+
egui = { version = "0.31", default-features = false }
2222
serde = { version = "1", optional = true, features = ["derive"] }
2323

2424
duplicate = "2.0"
2525
paste = "1.0"
2626

2727
[dev-dependencies]
28-
eframe = { version = "0.30", default-features = false, features = [
28+
eframe = { version = "0.31", default-features = false, features = [
2929
"default",
3030
"default_fonts",
3131
"glow",

Diff for: README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# `egui_dock`: docking system for [egui](https://github.com/emilk/egui)
22

33
[![github](https://img.shields.io/badge/github-Adanos020/egui_dock-8da0cb?logo=github)](https://github.com/Adanos020/egui_dock)
4-
[![Crates.io](https://img.shields.io/crates/v/egui_dock)](https://crates.io/crates/egui_dock)
4+
[![crates.io](https://img.shields.io/crates/v/egui_dock)](https://crates.io/crates/egui_dock)
55
[![docs.rs](https://img.shields.io/docsrs/egui_dock)](https://docs.rs/egui_dock/)
6-
[![egui_version](https://img.shields.io/badge/egui-0.30-blue)](https://github.com/emilk/egui)
6+
[![egui_version](https://img.shields.io/badge/egui-0.31-blue)](https://github.com/emilk/egui)
77

88
Originally created by [@lain-dono](https://github.com/lain-dono), this library provides a docking system for `egui`.
99

@@ -32,8 +32,8 @@ Add `egui` and `egui_dock` to your project's dependencies.
3232

3333
```toml
3434
[dependencies]
35-
egui = "0.30"
36-
egui_dock = "0.15"
35+
egui = "0.31"
36+
egui_dock = "0.16"
3737
```
3838

3939
Then proceed by setting up `egui`, following its [quick start guide](https://github.com/emilk/egui#quick-start).

Diff for: examples/hello.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::collections::HashSet;
55
use eframe::NativeOptions;
66
use egui::{
77
color_picker::{color_edit_button_srgba, Alpha},
8-
vec2, CentralPanel, ComboBox, Frame, Rounding, Slider, TopBottomPanel, Ui, ViewportBuilder,
8+
vec2, CentralPanel, ComboBox, CornerRadius, Frame, Slider, TopBottomPanel, Ui, ViewportBuilder,
99
WidgetText,
1010
};
1111

@@ -216,8 +216,8 @@ impl MyContext {
216216
);
217217
ui.end_row();
218218

219-
ui.label("Rounding:");
220-
rounding_ui(ui, &mut style.main_surface_border_rounding);
219+
ui.label("Corner radius:");
220+
corner_radius_ui(ui, &mut style.main_surface_border_rounding);
221221
ui.end_row();
222222
});
223223
});
@@ -287,25 +287,25 @@ impl MyContext {
287287
fn tab_style_editor_ui(ui: &mut Ui, tab_style: &mut TabInteractionStyle) {
288288
ui.separator();
289289

290-
ui.label("Rounding");
290+
ui.label("Corner radius");
291291
labeled_widget!(
292292
ui,
293-
Slider::new(&mut tab_style.rounding.nw, 0.0..=15.0),
293+
Slider::new(&mut tab_style.corner_radius.nw, 0..=15),
294294
"North-West"
295295
);
296296
labeled_widget!(
297297
ui,
298-
Slider::new(&mut tab_style.rounding.ne, 0.0..=15.0),
298+
Slider::new(&mut tab_style.corner_radius.ne, 0..=15),
299299
"North-East"
300300
);
301301
labeled_widget!(
302302
ui,
303-
Slider::new(&mut tab_style.rounding.sw, 0.0..=15.0),
303+
Slider::new(&mut tab_style.corner_radius.sw, 0..=15),
304304
"South-West"
305305
);
306306
labeled_widget!(
307307
ui,
308-
Slider::new(&mut tab_style.rounding.se, 0.0..=15.0),
308+
Slider::new(&mut tab_style.corner_radius.se, 0..=15),
309309
"South-East"
310310
);
311311

@@ -377,8 +377,8 @@ impl MyContext {
377377
ui.collapsing("Tab body", |ui| {
378378
ui.separator();
379379

380-
ui.label("Rounding");
381-
rounding_ui(ui, &mut style.tab.tab_body.rounding);
380+
ui.label("Corner radius");
381+
corner_radius_ui(ui, &mut style.tab.tab_body.corner_radius);
382382

383383
ui.label("Stroke width:");
384384
ui.add(Slider::new(
@@ -516,8 +516,8 @@ impl MyContext {
516516
ui.add(Slider::new(&mut style.overlay.hovered_leaf_highlight.expansion, -50.0..=50.0));
517517
ui.end_row();
518518
});
519-
ui.label("Rounding:");
520-
rounding_ui(ui, &mut style.overlay.hovered_leaf_highlight.rounding);
519+
ui.label("Corner radius:");
520+
corner_radius_ui(ui, &mut style.overlay.hovered_leaf_highlight.corner_radius);
521521
})
522522
});
523523
}
@@ -630,9 +630,9 @@ impl eframe::App for MyApp {
630630
}
631631
}
632632

633-
fn rounding_ui(ui: &mut Ui, rounding: &mut Rounding) {
634-
labeled_widget!(ui, Slider::new(&mut rounding.nw, 0.0..=15.0), "North-West");
635-
labeled_widget!(ui, Slider::new(&mut rounding.ne, 0.0..=15.0), "North-East");
636-
labeled_widget!(ui, Slider::new(&mut rounding.sw, 0.0..=15.0), "South-West");
637-
labeled_widget!(ui, Slider::new(&mut rounding.se, 0.0..=15.0), "South-East");
633+
fn corner_radius_ui(ui: &mut Ui, corner_radius: &mut CornerRadius) {
634+
labeled_widget!(ui, Slider::new(&mut corner_radius.nw, 0..=15), "North-West");
635+
labeled_widget!(ui, Slider::new(&mut corner_radius.ne, 0..=15), "North-East");
636+
labeled_widget!(ui, Slider::new(&mut corner_radius.sw, 0..=15), "South-West");
637+
labeled_widget!(ui, Slider::new(&mut corner_radius.se, 0..=15), "South-East");
638638
}

Diff for: src/style.rs

+28-40
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use egui::{ecolor::*, Margin, Rounding, Stroke};
1+
use egui::{ecolor::*, CornerRadius, Margin, Stroke};
22

33
/// Left or right alignment for tab add button.
44
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
@@ -53,7 +53,7 @@ pub struct Style {
5353
pub dock_area_padding: Option<Margin>,
5454

5555
pub main_surface_border_stroke: Stroke,
56-
pub main_surface_border_rounding: Rounding,
56+
pub main_surface_border_rounding: CornerRadius,
5757

5858
pub buttons: ButtonsStyle,
5959
pub separator: SeparatorStyle,
@@ -168,8 +168,8 @@ pub struct TabBarStyle {
168168
/// Show a scroll bar when tab bar overflows. By `Default` it's `true`.
169169
pub show_scroll_bar_on_overflow: bool,
170170

171-
/// Tab rounding. By `Default` it's [`Rounding::default`].
172-
pub rounding: Rounding,
171+
/// Tab corner_radius. By `Default` it's [`CornerRadius::default`].
172+
pub corner_radius: CornerRadius,
173173

174174
/// Color of the line separating the tab name area from the tab content area.
175175
/// By `Default` it's [`Color32::BLACK`].
@@ -227,8 +227,8 @@ pub struct TabInteractionStyle {
227227
/// Color of the outline around tabs. By `Default` it's [`Color32::BLACK`].
228228
pub outline_color: Color32,
229229

230-
/// Tab rounding. By `Default` it's [`Rounding::default`].
231-
pub rounding: Rounding,
230+
/// Tab corner radius. By `Default` it's [`CornerRadius::default`].
231+
pub corner_radius: CornerRadius,
232232

233233
/// Colour of the tab's background. By `Default` it's [`Color32::WHITE`].
234234
pub bg_fill: Color32,
@@ -247,8 +247,8 @@ pub struct TabBodyStyle {
247247
/// The stroke of the tabs border. By `Default` it's ['Stroke::default'].
248248
pub stroke: Stroke,
249249

250-
/// Tab rounding. By `Default` it's [`Rounding::default`].
251-
pub rounding: Rounding,
250+
/// Tab corner radius. By `Default` it's [`CornerRadius::default`].
251+
pub corner_radius: CornerRadius,
252252

253253
/// Colour of the tab's background. By `Default` it's [`Color32::WHITE`].
254254
pub bg_fill: Color32,
@@ -335,7 +335,7 @@ pub struct LeafHighlighting {
335335
pub color: Color32,
336336

337337
/// Rounding of the resulting rectangle.
338-
pub rounding: Rounding,
338+
pub corner_radius: CornerRadius,
339339

340340
/// Stroke.
341341
pub stroke: Stroke,
@@ -349,7 +349,7 @@ impl Default for Style {
349349
Self {
350350
dock_area_padding: None,
351351
main_surface_border_stroke: Stroke::new(f32::default(), Color32::BLACK),
352-
main_surface_border_rounding: Rounding::default(),
352+
main_surface_border_rounding: CornerRadius::default(),
353353
buttons: ButtonsStyle::default(),
354354
separator: SeparatorStyle::default(),
355355
tab_bar: TabBarStyle::default(),
@@ -410,7 +410,7 @@ impl Default for TabBarStyle {
410410
bg_fill: Color32::WHITE,
411411
height: 24.0,
412412
show_scroll_bar_on_overflow: true,
413-
rounding: Rounding::default(),
413+
corner_radius: CornerRadius::default(),
414414
hline_color: Color32::BLACK,
415415
fill_tab_bar: false,
416416
}
@@ -454,7 +454,7 @@ impl Default for TabInteractionStyle {
454454
Self {
455455
bg_fill: Color32::WHITE,
456456
outline_color: Color32::BLACK,
457-
rounding: Rounding::default(),
457+
corner_radius: CornerRadius::default(),
458458
text_color: Color32::DARK_GRAY,
459459
}
460460
}
@@ -463,9 +463,9 @@ impl Default for TabInteractionStyle {
463463
impl Default for TabBodyStyle {
464464
fn default() -> Self {
465465
Self {
466-
inner_margin: Margin::same(4.0),
466+
inner_margin: Margin::same(4),
467467
stroke: Stroke::default(),
468-
rounding: Rounding::default(),
468+
corner_radius: CornerRadius::default(),
469469
bg_fill: Color32::WHITE,
470470
}
471471
}
@@ -506,7 +506,7 @@ impl Default for LeafHighlighting {
506506
fn default() -> Self {
507507
Self {
508508
color: Color32::TRANSPARENT,
509-
rounding: Rounding::same(0.0),
509+
corner_radius: CornerRadius::same(0),
510510
stroke: Stroke::NONE,
511511
expansion: 0.0,
512512
}
@@ -537,7 +537,7 @@ impl Style {
537537
pub fn from_egui(style: &egui::Style) -> Self {
538538
Self {
539539
main_surface_border_stroke: Stroke::NONE,
540-
main_surface_border_rounding: Rounding::ZERO,
540+
main_surface_border_rounding: CornerRadius::ZERO,
541541
buttons: ButtonsStyle::from_egui(style),
542542
separator: SeparatorStyle::from_egui(style),
543543
tab_bar: TabBarStyle::from_egui(style),
@@ -617,16 +617,15 @@ impl TabBarStyle {
617617
///
618618
/// Fields overwritten by [`egui::Style`] are:
619619
/// - [`TabBarStyle::bg_fill`]
620-
/// - [`TabBarStyle::rounding`]
621620
/// - [`TabBarStyle::hline_color`]
622621
pub fn from_egui(style: &egui::Style) -> Self {
623622
Self {
624623
bg_fill: style.visuals.extreme_bg_color,
625-
rounding: Rounding {
626-
nw: style.visuals.widgets.inactive.rounding.nw + 2.0,
627-
ne: style.visuals.widgets.inactive.rounding.ne + 2.0,
628-
sw: 0.0,
629-
se: 0.0,
624+
corner_radius: CornerRadius {
625+
nw: style.visuals.widgets.inactive.corner_radius.nw + 2,
626+
ne: style.visuals.widgets.inactive.corner_radius.ne + 2,
627+
sw: 0,
628+
se: 0,
630629
},
631630
hline_color: style.visuals.widgets.noninteractive.bg_stroke.color,
632631
..TabBarStyle::default()
@@ -661,16 +660,15 @@ impl TabInteractionStyle {
661660
/// - [`TabInteractionStyle::outline_color`]
662661
/// - [`TabInteractionStyle::bg_fill`]
663662
/// - [`TabInteractionStyle::text_color`]
664-
/// - [`TabInteractionStyle::rounding`]
665663
pub fn from_egui_active(style: &egui::Style) -> Self {
666664
Self {
667665
outline_color: style.visuals.widgets.noninteractive.bg_stroke.color,
668666
bg_fill: style.visuals.window_fill(),
669667
text_color: style.visuals.text_color(),
670-
rounding: Rounding {
671-
sw: 0.0,
672-
se: 0.0,
673-
..style.visuals.widgets.active.rounding
668+
corner_radius: CornerRadius {
669+
sw: 0,
670+
se: 0,
671+
..style.visuals.widgets.active.corner_radius
674672
},
675673
}
676674
}
@@ -681,15 +679,11 @@ impl TabInteractionStyle {
681679
/// - [`TabInteractionStyle::outline_color`]
682680
/// - [`TabInteractionStyle::bg_fill`]
683681
/// - [`TabInteractionStyle::text_color`]
684-
/// - [`TabInteractionStyle::rounding`]
685682
pub fn from_egui_inactive(style: &egui::Style) -> Self {
686683
Self {
687684
text_color: style.visuals.text_color(),
688-
bg_fill: egui::ecolor::tint_color_towards(
689-
style.visuals.window_fill,
690-
style.visuals.extreme_bg_color,
691-
),
692-
outline_color: egui::ecolor::tint_color_towards(
685+
bg_fill: tint_color_towards(style.visuals.window_fill, style.visuals.extreme_bg_color),
686+
outline_color: tint_color_towards(
693687
style.visuals.widgets.noninteractive.bg_stroke.color,
694688
style.visuals.extreme_bg_color,
695689
),
@@ -703,7 +697,6 @@ impl TabInteractionStyle {
703697
/// - [`TabInteractionStyle::outline_color`]
704698
/// - [`TabInteractionStyle::bg_fill`]
705699
/// - [`TabInteractionStyle::text_color`]
706-
/// - [`TabInteractionStyle::rounding`]
707700
pub fn from_egui_focused(style: &egui::Style) -> Self {
708701
Self {
709702
text_color: style.visuals.strong_text_color(),
@@ -717,7 +710,6 @@ impl TabInteractionStyle {
717710
/// - [`TabInteractionStyle::outline_color`]
718711
/// - [`TabInteractionStyle::bg_fill`]
719712
/// - [`TabInteractionStyle::text_color`]
720-
/// - [`TabInteractionStyle::rounding`]
721713
pub fn from_egui_hovered(style: &egui::Style) -> Self {
722714
Self {
723715
text_color: style.visuals.strong_text_color(),
@@ -732,7 +724,6 @@ impl TabInteractionStyle {
732724
/// - [`TabInteractionStyle::outline_color`]
733725
/// - [`TabInteractionStyle::bg_fill`]
734726
/// - [`TabInteractionStyle::text_color`]
735-
/// - [`TabInteractionStyle::rounding`]
736727
pub fn from_egui_active_with_kb_focus(style: &egui::Style) -> Self {
737728
Self {
738729
text_color: style.visuals.strong_text_color(),
@@ -747,7 +738,6 @@ impl TabInteractionStyle {
747738
/// - [`TabInteractionStyle::outline_color`]
748739
/// - [`TabInteractionStyle::bg_fill`]
749740
/// - [`TabInteractionStyle::text_color`]
750-
/// - [`TabInteractionStyle::rounding`]
751741
pub fn from_egui_inactive_with_kb_focus(style: &egui::Style) -> Self {
752742
Self {
753743
text_color: style.visuals.strong_text_color(),
@@ -762,7 +752,6 @@ impl TabInteractionStyle {
762752
/// - [`TabInteractionStyle::outline_color`]
763753
/// - [`TabInteractionStyle::bg_fill`]
764754
/// - [`TabInteractionStyle::text_color`]
765-
/// - [`TabInteractionStyle::rounding`]
766755
pub fn from_egui_focused_with_kb_focus(style: &egui::Style) -> Self {
767756
Self {
768757
text_color: style.visuals.strong_text_color(),
@@ -778,13 +767,12 @@ impl TabBodyStyle {
778767
/// Fields overwritten by [`egui::Style`] are:
779768
/// - [`TabBodyStyle::inner_margin`]
780769
/// - [`TabBodyStyle::stroke]
781-
/// - [`TabBodyStyle::rounding`]
782770
/// - [`TabBodyStyle::bg_fill`]
783771
pub fn from_egui(style: &egui::Style) -> Self {
784772
Self {
785773
inner_margin: style.spacing.window_margin,
786774
stroke: style.visuals.widgets.noninteractive.bg_stroke,
787-
rounding: style.visuals.widgets.active.rounding,
775+
corner_radius: style.visuals.widgets.active.corner_radius,
788776
bg_fill: style.visuals.window_fill(),
789777
}
790778
}

0 commit comments

Comments
 (0)