Skip to content

Commit 8fd9be6

Browse files
authored
Make it so separators are always clamped between their bounds (#289)
* Make it so separators are always clamped between their bounds * Update changelog
1 parent 78e5325 commit 8fd9be6

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

CHANGELOG.md

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

3+
## egui_dock 0.18.0 - unreleased
4+
5+
### Changed
6+
7+
- Node separators are always clamped between their bounds. ([#289](https://github.com/Adanos020/egui_dock/pull/289))
8+
39
## egui_dock 0.17.0 - 2025/07/13
410

511
### Breaking changes

src/widgets/dock_area/show/mod.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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)