From dcecec542673c8d94640e73ab7d37148a4192a36 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 8 Nov 2022 00:15:39 +0100 Subject: [PATCH 1/3] Remove stroke around panels and replace with separator single line --- crates/egui/src/containers/frame.rs | 4 ---- crates/egui/src/containers/panel.rs | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/crates/egui/src/containers/frame.rs b/crates/egui/src/containers/frame.rs index f777b8c4e4d..7da48cc2273 100644 --- a/crates/egui/src/containers/frame.rs +++ b/crates/egui/src/containers/frame.rs @@ -45,9 +45,7 @@ impl Frame { pub(crate) fn side_top_panel(style: &Style) -> Self { Self { inner_margin: Margin::symmetric(8.0, 2.0), - rounding: Rounding::none(), fill: style.visuals.window_fill(), - stroke: style.visuals.window_stroke(), ..Default::default() } } @@ -55,9 +53,7 @@ impl Frame { pub(crate) fn central_panel(style: &Style) -> Self { Self { inner_margin: Margin::same(8.0), - rounding: Rounding::none(), fill: style.visuals.window_fill(), - stroke: Default::default(), ..Default::default() } } diff --git a/crates/egui/src/containers/panel.rs b/crates/egui/src/containers/panel.rs index 73b3f8d39ac..80cd17ef125 100644 --- a/crates/egui/src/containers/panel.rs +++ b/crates/egui/src/containers/panel.rs @@ -249,7 +249,7 @@ impl SidePanel { let dragging_something_else = any_down || ui.input().pointer.any_pressed(); resize_hover = mouse_over_resize_line && !dragging_something_else; - if resize_hover || is_resizing { + { ui.output().cursor_icon = CursorIcon::ResizeHorizontal; } } @@ -282,11 +282,14 @@ impl SidePanel { PanelState { rect }.store(ui.ctx(), id); - if resize_hover || is_resizing { + { let stroke = if is_resizing { ui.style().visuals.widgets.active.bg_stroke - } else { + } else if resize_hover { ui.style().visuals.widgets.hovered.bg_stroke + } else { + // TOOD(emilk): distinguish resizable from non-resizable + ui.style().visuals.widgets.noninteractive.bg_stroke }; // draw on top of ALL panels so that the resize line won't be covered by subsequent panels let resize_layer = LayerId::new(Order::Foreground, Id::new("panel_resize")); @@ -679,7 +682,7 @@ impl TopBottomPanel { let dragging_something_else = any_down || ui.input().pointer.any_pressed(); resize_hover = mouse_over_resize_line && !dragging_something_else; - if resize_hover || is_resizing { + { ui.output().cursor_icon = CursorIcon::ResizeVertical; } } @@ -712,11 +715,14 @@ impl TopBottomPanel { PanelState { rect }.store(ui.ctx(), id); - if resize_hover || is_resizing { + { let stroke = if is_resizing { ui.style().visuals.widgets.active.bg_stroke - } else { + } else if resize_hover { ui.style().visuals.widgets.hovered.bg_stroke + } else { + // TOOD(emilk): distinguish resizable from non-resizable + ui.style().visuals.widgets.noninteractive.bg_stroke }; // draw on top of ALL panels so that the resize line won't be covered by subsequent panels let resize_layer = LayerId::new(Order::Foreground, Id::new("panel_resize")); From 172c58bd0c9c6736d5313db0043beab5ae993e90 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 8 Nov 2022 00:15:51 +0100 Subject: [PATCH 2/3] Remove item_spacing between panels --- crates/egui/src/containers/panel.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/egui/src/containers/panel.rs b/crates/egui/src/containers/panel.rs index 80cd17ef125..3def3c32163 100644 --- a/crates/egui/src/containers/panel.rs +++ b/crates/egui/src/containers/panel.rs @@ -270,10 +270,10 @@ impl SidePanel { let mut cursor = ui.cursor(); match side { Side::Left => { - cursor.min.x = rect.max.x + ui.spacing().item_spacing.x; + cursor.min.x = rect.max.x; } Side::Right => { - cursor.max.x = rect.min.x - ui.spacing().item_spacing.x; + cursor.max.x = rect.min.x; } } ui.set_cursor(cursor); @@ -703,10 +703,10 @@ impl TopBottomPanel { let mut cursor = ui.cursor(); match side { TopBottomSide::Top => { - cursor.min.y = rect.max.y + ui.spacing().item_spacing.y; + cursor.min.y = rect.max.y; } TopBottomSide::Bottom => { - cursor.max.y = rect.min.y - ui.spacing().item_spacing.y; + cursor.max.y = rect.min.y; } } ui.set_cursor(cursor); From 5e57771e727734973856a04a25b4422b09bcae24 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 8 Nov 2022 00:22:04 +0100 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f235c19bca..73c5ae3edfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG * Added `egui::gui_zoom` module with helpers for scaling the whole GUI of an app ([#2239](https://github.com/emilk/egui/pull/2239)). * You can now put one interactive widget on top of another, and only one will get interaction at a time ([#2244](https://github.com/emilk/egui/pull/2244)). +### Changed 🔧 +* Panels always have a separator line, but no stroke on other sides. Their spacing has also changed slightly ([#2261](https://github.com/emilk/egui/pull/2261)). + ### Fixed 🐛 * ⚠️ BREAKING: Fix text being too small ([#2069](https://github.com/emilk/egui/pull/2069)). * Improved text rendering ([#2071](https://github.com/emilk/egui/pull/2071)). @@ -42,7 +45,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG * Added `PointerState::button_double_clicked()` and `PointerState::button_triple_clicked()` ([#1906](https://github.com/emilk/egui/issues/1906)). * Added `custom_formatter`, `binary`, `octal`, and `hexadecimal` to `DragValue` and `Slider` ([#1953](https://github.com/emilk/egui/issues/1953)) -### Changed +### Changed 🔧 * MSRV (Minimum Supported Rust Version) is now `1.61.0` ([#1846](https://github.com/emilk/egui/pull/1846)). * `PaintCallback` shapes now require the whole callback to be put in an `Arc` with the value being a backend-specific callback type ([#1684](https://github.com/emilk/egui/pull/1684)). * Replaced `needs_repaint` in `FullOutput` with `repaint_after`. Used to force repaint after the set duration in reactive mode ([#1694](https://github.com/emilk/egui/pull/1694)).