1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Don't expand widgets on hover (#7808)

* Part of https://github.com/emilk/egui/issues/5605

This changes the default style of egui.

The problem with "expanding" widgets is that they now want to paint
outside their own bounds, which then requires all parent UIs to have
proper margins.

It also means hovered things are no longer properly aligned with every
other widget.
This commit is contained in:
Emil Ernerfeldt
2025-12-22 22:30:53 +01:00
committed by GitHub
parent f53a9c96d5
commit 9e95b9ca50
29 changed files with 65 additions and 60 deletions

View File

@@ -1234,6 +1234,11 @@ pub struct WidgetVisuals {
pub fg_stroke: Stroke,
/// Make the frame this much larger.
///
/// The problem with "expanding" widgets is that they now want to paint outside their own bounds,
/// which then requires all parent UIs to have proper margins.
///
/// It also means hovered things are no longer properly aligned with every other widget.
pub expansion: f32,
}
@@ -1568,7 +1573,7 @@ impl Widgets {
bg_stroke: Stroke::new(1.0, Color32::from_gray(150)), // e.g. hover over window edge or button
fg_stroke: Stroke::new(1.5, Color32::from_gray(240)),
corner_radius: CornerRadius::same(3),
expansion: 1.0,
expansion: 0.0,
},
active: WidgetVisuals {
weak_bg_fill: Color32::from_gray(55),
@@ -1576,7 +1581,7 @@ impl Widgets {
bg_stroke: Stroke::new(1.0, Color32::WHITE),
fg_stroke: Stroke::new(2.0, Color32::WHITE),
corner_radius: CornerRadius::same(2),
expansion: 1.0,
expansion: 0.0,
},
open: WidgetVisuals {
weak_bg_fill: Color32::from_gray(45),
@@ -1613,7 +1618,7 @@ impl Widgets {
bg_stroke: Stroke::new(1.0, Color32::from_gray(105)), // e.g. hover over window edge or button
fg_stroke: Stroke::new(1.5, Color32::BLACK),
corner_radius: CornerRadius::same(3),
expansion: 1.0,
expansion: 0.0,
},
active: WidgetVisuals {
weak_bg_fill: Color32::from_gray(165),
@@ -1621,7 +1626,7 @@ impl Widgets {
bg_stroke: Stroke::new(1.0, Color32::BLACK),
fg_stroke: Stroke::new(2.0, Color32::BLACK),
corner_radius: CornerRadius::same(2),
expansion: 1.0,
expansion: 0.0,
},
open: WidgetVisuals {
weak_bg_fill: Color32::from_gray(220),

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7051c34854469652d2d953f3110ebcf6fd60f8ee9a2b0c134d9f7255ef180ce5
size 335353
oid sha256:5878bc5beaf4406c24f23d900aa9ac7c5507e44cb3ade83b743b8b62e7da1615
size 335355

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:49823cfa4dfba54e54d0122f2bbb246c1daad2ca3ba15071c1ca44eeb3662855
size 92791
oid sha256:706ad012e52a8c51175b050b985cca88e2cb306b24f618b7391641397d17cd28
size 92804

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1b65b6b1a3afe41337b8fe537525677284e49bd90be29cddb837787162ee452a
size 169596
oid sha256:4135662f2b60a10ef8c3b155172d7a3edcf24a625d8286aeaad0614aa8819893
size 169604

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9c3af0c37a6997abe549dd28450c41d3d18bbc99d9577997d493566fbb7f9277
size 96709
oid sha256:509020d8885b718900e534c9948cb95ae88e1eee9e113bdfb77a2f75b9a68f7b
size 96703

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:27e4950f17ab7f68f7e001ca3a4f3fc18943103f4745c87715dcf6c097e92a57
size 11131
oid sha256:5b6447dd4bd6489b9b909b8240abe54db16331beaa2fb4656f01f79a08fb25f9
size 11112

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:449cc473469dc80af81fe20e394dd90e67b4ae9c2033ebb7029726274d77d50c
size 21644
oid sha256:4baf110e63fb104f30e9ae06e3601cfb48d7b69aec31636ca470c9ba9f6d44a9
size 21659

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1cbfc767ed169cbddb3c90c2b455daefd85925501e7e33c7a25a34a72fc13eac
size 28512
oid sha256:93d2f336e216f371e7239b08113e659bad6c30eb299a2d8ea9537ae1c63533f0
size 28503

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f4397b3d86bb5fe76d661cdb109ef71d43e771093bd9267b74722660d312ec7d
size 33253
oid sha256:6bf27cde6a87112a1ae832a65c80a9e34243b6ee368314379f5bf018edf439e5
size 33239

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fad8b83e553ffa6bfbc4d47b955f2180859048c3789dda99b640e27665d216c7
size 2244
oid sha256:e86ed66f3ac3a81998eefbed8cb231edc6522174050676b45e9248f9e7f18533
size 2227