Fix: button_padding
when using image+text buttons (#2510)
* feat(image-button-margin): implement image button margin - add `image_margin` field on `Button` widget - implement setter method called `image_margin` for `Button` widget - use margin from `image_margin` field of `Button` widget in `Widget` trait functions * feat(image-button-margin): update changelog * feat(image-button-margin): implement `map_or` clippy fix * feat(image-button-margin): remove margin field & fix button-padding instead * feat(image-button-margin): fix CI errors * feat(image-button-margin): update changelog to include fix * feat(image-button-margin): re-add changes after creating screenshots for PR
This commit is contained in:
parent
53b1d0e5e9
commit
0ad8aea811
2 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue