Fix image button padding on hover (#1595)
This commit is contained in:
parent
7b18fab7a4
commit
e44c9b8e54
2 changed files with 3 additions and 7 deletions
|
@ -7,7 +7,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui-w
|
|||
## Unreleased
|
||||
* Add `*_released` & `*_clicked` methods for `PointerState` ([#1582](https://github.com/emilk/egui/pull/1582)).
|
||||
* Optimize painting of filled circles (e.g. for scatter plots) by 10x or more ([#1616](https://github.com/emilk/egui/pull/1616)).
|
||||
|
||||
* Fixed `ImageButton`'s changing background padding on hover ([#1595](https://github.com/emilk/egui/pull/1595)).
|
||||
|
||||
## 0.18.1 - 2022-05-01
|
||||
* Change `Shape::Callback` from `&dyn Any` to `&mut dyn Any` to support more backends.
|
||||
|
|
|
@ -489,18 +489,14 @@ impl Widget for ImageButton {
|
|||
let (expansion, rounding, fill, stroke) = if selected {
|
||||
let selection = ui.visuals().selection;
|
||||
(
|
||||
-padding,
|
||||
Vec2::ZERO,
|
||||
Rounding::none(),
|
||||
selection.bg_fill,
|
||||
selection.stroke,
|
||||
)
|
||||
} else if frame {
|
||||
let visuals = ui.style().interact(&response);
|
||||
let expansion = if response.hovered {
|
||||
Vec2::splat(visuals.expansion) - padding
|
||||
} else {
|
||||
Vec2::splat(visuals.expansion)
|
||||
};
|
||||
let expansion = Vec2::splat(visuals.expansion);
|
||||
(
|
||||
expansion,
|
||||
visuals.rounding,
|
||||
|
|
Loading…
Reference in a new issue