1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Panels: Take separator line width into account (#8367)

This fixes a small styling bug: the width of the panel's
resize-handle-line was not included in the outer width of the panel. Now
it is.
This commit is contained in:
Emil Ernerfeldt
2026-08-01 03:13:52 -07:00
committed by GitHub
parent b06f5fea09
commit 4471969a16
11 changed files with 37 additions and 18 deletions

View File

@@ -859,8 +859,27 @@ impl Panel {
/// The configured [`Frame`], or the default side/top panel frame for this [`Ui`].
fn resolve_frame(&self, ui: &Ui) -> Frame {
self.frame
.unwrap_or_else(|| Frame::side_top_panel(ui.style()))
let mut frame = self
.frame
.unwrap_or_else(|| Frame::side_top_panel(ui.style()));
let has_separator_line = self.show_separator_line || self.resizable;
if has_separator_line {
// The separator line has a thickness that we need to account for.
let widgets = &ui.style().visuals.widgets;
let stroke_width = widgets.noninteractive.bg_stroke.width.round() as i8;
let margin_side = match self.side {
PanelSide::Left => &mut frame.inner_margin.right,
PanelSide::Right => &mut frame.inner_margin.left,
PanelSide::Top => &mut frame.inner_margin.bottom,
PanelSide::Bottom => &mut frame.inner_margin.top,
};
*margin_side = (*margin_side).saturating_add(stroke_width);
}
frame
}
/// Panel is fully closed. If the user is still dragging the resize handle

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:288e11a1fa684575155826a760d5aecc5855e1f4b68bc8954441bf3ac015ee84
size 335175
oid sha256:dda3ad81551d0001bb9d3614a266010e44c8c18700964d8734c3e825672d9383
size 334759

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d674918c635bfc865043f2123c0f5d4a671dd21ba7b878c056e817b19f2e8f00
size 92770
oid sha256:9035687ecd3aae0d8639000f091592d69acec0e73e7ba17e04c9794c5321cb1e
size 92771

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1f066e712888a57b5c5ca6ccd6e138c933ab04acc44a3fce5912cfe47852c672
size 168875
oid sha256:418f9bc7eb13dd32ce2bba8e4b8003b095dd00aa8c30f1640ea0f94f87a085eb
size 168430

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1cf4c34af7b69cd8220b11ff7e355ddf8d7b52a43a60a1748abf9cc1d5c7da9b
size 98869
oid sha256:8d278d0d879e8cb44c4c2e65bdee4441616abcf3507adc37959ccf042991b31c
size 98780

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8d48079f85e9529f4b463bbaf2c948a64126388ef32df0584b586dc0ae48a35b
size 344919
oid sha256:d20f4bf882ee16abde6268fe766ceb67dccdfc5d2a509a952cef1d7af72dc3c6
size 344141

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3e44cef45d27ddd64b0d2f6de0b7005846147bce54a9b8b1223ba9a0a02c2416
oid sha256:125d6fe0cdc81a0c7973317e62c528c1beff7ceaedb9cb1fb91bc8d6674c8dc6
size 62830