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

Fix image button padding on hover (#1595)

This commit is contained in:
Luke Newcomb
2022-05-11 05:58:15 -04:00
committed by GitHub
parent 7b18fab7a4
commit e44c9b8e54
2 changed files with 3 additions and 7 deletions

View File

@@ -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,