diff --git a/CHANGELOG.md b/CHANGELOG.md index 3adff09a1..e6ad6728f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG ### Fixed 🐛 * Expose `TextEdit`'s multiline flag to AccessKit ([#2448](https://github.com/emilk/egui/pull/2448)). * Don't render `\r` (Carriage Return) ([#2452](https://github.com/emilk/egui/pull/2452)). +* The `button_padding` style option works closer as expected with image+text buttons now ([#2510](https://github.com/emilk/egui/pull/2510)). ## 0.20.1 - 2022-12-11 - Fix key-repeat diff --git a/crates/egui/src/widgets/button.rs b/crates/egui/src/widgets/button.rs index 193854700..7f050a06c 100644 --- a/crates/egui/src/widgets/button.rs +++ b/crates/egui/src/widgets/button.rs @@ -221,7 +221,10 @@ impl Widget for Button { if let Some(image) = image { let image_rect = Rect::from_min_size( - pos2(rect.min.x, rect.center().y - 0.5 - (image.size().y / 2.0)), + pos2( + rect.min.x + button_padding.x, + rect.center().y - 0.5 - (image.size().y / 2.0), + ), image.size(), ); image.paint_at(ui, image_rect);