Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaflo committed May 31, 2024
1 parent d85f872 commit 950f7ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Core/src/Platform/Android/ImageButtonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public static void UpdateCornerRadius(this ShapeableImageView platformButton, IB
public static async void UpdatePadding(this ShapeableImageView platformButton, IImageButton imageButton)
{
var padding = platformButton.Context!.ToPixels(imageButton.Padding);
var (width, _, radius) = imageButton.GetStrokeProperties(platformButton.Context!, true);
int additionalPadding = System.Math.Max(width, radius / 2);
var (strokeWidth, _, strokeRadius) = imageButton.GetStrokeProperties(platformButton.Context!, true);
int additionalPadding = System.Math.Max(strokeWidth, strokeRadius / 2);
padding = new Thickness(padding.Left + additionalPadding, padding.Top + additionalPadding, padding.Right + additionalPadding, padding.Bottom + additionalPadding);

// The simple operation we are trying to do.
Expand Down
3 changes: 3 additions & 0 deletions src/Core/src/Platform/iOS/ButtonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ public static void UpdatePadding(this UIButton platformButton, Thickness padding
if (padding.IsNaN)
padding = defaultPadding ?? Thickness.Zero;

int additionalPadding = (int)Math.Max(platformButton.Layer.BorderWidth, platformButton.Layer.CornerRadius / 2);
padding = new Thickness(padding.Left + additionalPadding, padding.Top + additionalPadding, padding.Right + additionalPadding, padding.Bottom + additionalPadding);

// top and bottom insets reset to a "default" if they are exactly 0
// however, internally they are floor-ed, so there is no actual fractions
var top = padding.Top;
Expand Down

0 comments on commit 950f7ba

Please sign in to comment.