1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Panel visual improvements (#2261)

* Remove stroke around panels and replace with separator single line

* Remove item_spacing between panels

* Update changelog
This commit is contained in:
Emil Ernerfeldt
2022-11-08 00:34:31 +01:00
committed by GitHub
parent 75a825e9a1
commit 4aacb4575b
3 changed files with 20 additions and 15 deletions

View File

@@ -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()
}
}

View File

@@ -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;
}
}
@@ -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);
@@ -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;
}
}
@@ -700,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);
@@ -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"));