Skip to content

Commit 5046fb4

Browse files
anhoshAvarel
andauthored
Release 0.18 (#295)
* Update to egui 0.33 (#293) * Make it so separators are always clamped between their bounds (#289) * Make it so separators are always clamped between their bounds * Update changelog * Update documentation on `Tree::split_*` methods * Update changelog and readme --------- Co-authored-by: Avarel <antranprm@gmail.com>
1 parent 469dd38 commit 5046fb4

File tree

6 files changed

+37
-35
lines changed

6 files changed

+37
-35
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# egui_dock changelog
22

3+
## egui_dock 0.18.0 - 2025/10/31
4+
5+
### Breaking changes
6+
7+
- Upgraded to egui 0.33 ([#293](https://github.com/Adanos020/egui_dock/pull/293))
8+
9+
### Changed
10+
11+
- Node separators are always clamped between their bounds. ([#289](https://github.com/Adanos020/egui_dock/pull/289))
12+
313
## egui_dock 0.17.0 - 2025/07/13
414

515
### Breaking changes

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ default = []
1818
serde = ["dep:serde", "egui/serde"]
1919

2020
[dependencies]
21-
egui = { version = "0.32", default-features = false }
21+
egui = { version = "0.33", 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.32", default-features = false, features = [
28+
eframe = { version = "0.33", default-features = false, features = [
2929
"default",
3030
"default_fonts",
3131
"glow",

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![github](https://img.shields.io/badge/github-Adanos020/egui_dock-8da0cb?logo=github)](https://github.com/Adanos020/egui_dock)
44
[![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.32-blue)](https://github.com/emilk/egui)
6+
[![egui_version](https://img.shields.io/badge/egui-0.33-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.32"
36-
egui_dock = "0.17"
35+
egui = "0.33"
36+
egui_dock = "0.18"
3737
```
3838

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

src/dock_state/tree/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ impl<Tab> Tree<Tab> {
297297
/// Creates two new nodes by splitting a given `parent` node and assigns them as its children. The first (old) node
298298
/// inherits content of the `parent` from before the split, and the second (new) gets the `tabs`.
299299
///
300-
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will occupy after the
301-
/// split.
300+
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will attempt to occupy
301+
/// after the split.
302302
///
303303
/// The new node is placed relatively to the old node, in the direction specified by `split`.
304304
///
@@ -341,8 +341,8 @@ impl<Tab> Tree<Tab> {
341341
///
342342
/// This is a shorthand for using `split_tabs` with [`Split::Above`].
343343
///
344-
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will occupy after the
345-
/// split.
344+
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will attempt to occupy
345+
/// after the split.
346346
///
347347
/// The new node is placed *above* the old node.
348348
///
@@ -366,8 +366,8 @@ impl<Tab> Tree<Tab> {
366366
///
367367
/// This is a shorthand for using `split_tabs` with [`Split::Below`].
368368
///
369-
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will occupy after the
370-
/// split.
369+
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will attempt to occupy
370+
/// after the split.
371371
///
372372
/// The new node is placed *below* the old node.
373373
///
@@ -391,8 +391,8 @@ impl<Tab> Tree<Tab> {
391391
///
392392
/// This is a shorthand for using `split_tabs` with [`Split::Left`].
393393
///
394-
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will occupy after the
395-
/// split.
394+
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will attempt to occupy
395+
/// after the split.
396396
///
397397
/// The new node is placed to the *left* of the old node.
398398
///
@@ -416,8 +416,8 @@ impl<Tab> Tree<Tab> {
416416
///
417417
/// This is a shorthand for using `split_tabs` with [`Split::Right`].
418418
///
419-
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will occupy after the
420-
/// split.
419+
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will attempt to occupy
420+
/// after the split.
421421
///
422422
/// The new node is placed to the *right* of the old node.
423423
///
@@ -439,8 +439,8 @@ impl<Tab> Tree<Tab> {
439439
/// Creates two new nodes by splitting a given `parent` node and assigns them as its children. The first (old) node
440440
/// inherits content of the `parent` from before the split, and the second (new) uses `new`.
441441
///
442-
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will occupy after the
443-
/// split.
442+
/// `fraction` (in range 0..=1) specifies how much of the `parent` node's area the old node will attempt to occupy
443+
/// after the split.
444444
///
445445
/// The new node is placed relatively to the old node, in the direction specified by `split`.
446446
///

src/widgets/dock_area/drag_and_drop.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ enum LockState {
153153
/// Lock remains locked, but can be unlocked.
154154
SoftLock,
155155

156-
/// Lock is locked forever.
156+
/// Lock is locked forever.
157157
HardLock,
158158
}
159159

@@ -451,12 +451,12 @@ fn draw_window_rect(rect: Rect, ui: &Ui, style: &Style) {
451451
fn constrain_rect_to_area(ui: &Ui, rect: Rect, mut bounds: Rect) -> Rect {
452452
if rect.width() > bounds.width() {
453453
// Allow overlapping side bars.
454-
let screen_rect = ui.ctx().screen_rect();
454+
let screen_rect = ui.ctx().content_rect();
455455
(bounds.min.x, bounds.max.x) = (screen_rect.min.x, screen_rect.max.x);
456456
}
457457
if rect.height() > bounds.height() {
458458
// Allow overlapping top/bottom bars:
459-
let screen_rect = ui.ctx().screen_rect();
459+
let screen_rect = ui.ctx().content_rect();
460460
(bounds.min.y, bounds.max.y) = (screen_rect.min.y, screen_rect.max.y);
461461
}
462462

src/widgets/dock_area/show/mod.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl<Tab> DockArea<'_, Tab> {
6666
pub fn show_inside(mut self, ui: &mut Ui, tab_viewer: &mut impl TabViewer<Tab = Tab>) {
6767
self.style
6868
.get_or_insert(Style::from_egui(ui.style().as_ref()));
69-
self.window_bounds.get_or_insert(ui.ctx().screen_rect());
69+
self.window_bounds.get_or_insert(ui.ctx().content_rect());
7070

7171
let mut state = State::load(ui.ctx(), self.id);
7272

@@ -565,20 +565,12 @@ impl<Tab> DockArea<'_, Tab> {
565565
// Update 'fraction' interaction after drawing separator,
566566
// otherwise it may overlap on other separator / bodies when
567567
// shrunk fast.
568-
if let Some(pos) = response.interact_pointer_pos().or(arrow_key_offset.map(|v| separator.center() + v)) {
569-
let dim_point = pos.dim_point;
570-
let delta = arrow_key_offset.unwrap_or(response.drag_delta()).dim_point;
571-
572-
if (delta > 0. && dim_point > midpoint && dim_point < rect.max.dim_point)
573-
|| (delta < 0. && dim_point < midpoint && dim_point > rect.min.dim_point)
574-
{
575-
let range = rect.max.dim_point - rect.min.dim_point;
576-
let min = (style.separator.extra / range).min(1.0);
577-
let max = 1.0 - min;
578-
let (min, max) = (min.min(max), max.max(min));
579-
split.fraction = (split.fraction + delta / range).clamp(min, max);
580-
}
581-
}
568+
let range = rect.max.dim_point - rect.min.dim_point;
569+
let min = (style.separator.extra / range).min(1.0);
570+
let max = 1.0 - min;
571+
let (min, max) = (min.min(max), max.max(min));
572+
let delta = arrow_key_offset.unwrap_or(response.drag_delta()).dim_point;
573+
split.fraction = (split.fraction + delta / range).clamp(min, max);
582574

583575
if response.double_clicked() {
584576
split.fraction = 0.5;

0 commit comments

Comments
 (0)