Skip to content

Commit abf65c7

Browse files
972079 - Fixed Picker Footer Issue
1 parent 5efd2fa commit abf65c7

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

maui/src/Core/Helper/IconButton/SfIconButton.cs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ internal class SfIconButton : Grid, ITouchListener
4343
/// </summary>
4444
readonly bool _isHoveringOnReleased;
4545

46+
/// <summary>
47+
/// Holds the view which is used to clip.
48+
/// </summary>
49+
Grid clipView;
50+
4651
#if __MACCATALYST__ || (!__ANDROID__ && !__IOS__)
4752
/// <summary>
4853
/// Holds the value to denotes the mouse cursor exited.
@@ -66,11 +71,15 @@ internal SfIconButton(View child, bool showTouchEffect = true, bool isSquareSele
6671
_showTouchEffect = showTouchEffect;
6772
_isSquareSelection = isSquareSelection;
6873
_isHoveringOnReleased = isHoveringOnReleased;
74+
clipView = new Grid();
6975
EffectsView = new SfEffectsView();
7076
#if __IOS__
7177
IgnoreSafeArea = true;
78+
clipView.IgnoreSafeArea = true;
7279
EffectsView.IgnoreSafeArea = true;
7380
#endif
81+
//// - TODO directly clip the parent view cause the crash in the view. So, we add the grid view for the clip purpose.
82+
clipView.Add(this.EffectsView);
7483
Add(EffectsView);
7584
EffectsView.Content = child;
7685
EffectsView.ShouldIgnoreTouches = true;
@@ -200,16 +209,15 @@ void UpdateClip(double width, double height)
200209
{
201210
if (_isSquareSelection || width < 0 || height < 0)
202211
{
203-
EffectsView.Clip = null;
204212
return;
205213
}
206214

207215
double centerX = Math.Min(width, height) / 2;
208216
EllipseGeometry currentClip = new EllipseGeometry() { Center = new Point(width / 2, height / 2), RadiusX = centerX, RadiusY = centerX };
209217
EllipseGeometry? previousClip = null;
210-
if (EffectsView.Clip != null && EffectsView.Clip is EllipseGeometry)
218+
if (clipView.Clip != null && clipView.Clip is EllipseGeometry)
211219
{
212-
previousClip = (EllipseGeometry)EffectsView.Clip;
220+
previousClip = (EllipseGeometry)clipView.Clip;
213221
}
214222

215223
//// If the previous and current clip values are same, then no need to update the effects view clip.
@@ -218,7 +226,7 @@ void UpdateClip(double width, double height)
218226
return;
219227
}
220228

221-
EffectsView.Clip = currentClip;
229+
clipView.Clip = currentClip;
222230
}
223231

224232
#if __MACCATALYST__ || (!__ANDROID__ && !__IOS__)
@@ -237,7 +245,7 @@ void ApplyCornerClip()
237245
};
238246

239247
RoundRectangleGeometry? previousClip = null;
240-
if (EffectsView.Clip != null && EffectsView.Clip is RoundRectangleGeometry previous)
248+
if (clipView.Clip != null && clipView.Clip is RoundRectangleGeometry previous)
241249
{
242250
previousClip = previous;
243251
}
@@ -248,7 +256,7 @@ void ApplyCornerClip()
248256
return;
249257
}
250258

251-
EffectsView.Clip = currentClip;
259+
clipView.Clip = currentClip;
252260
}
253261
}
254262
#endif
@@ -274,6 +282,20 @@ protected override Size MeasureOverride(double widthConstraint, double heightCon
274282
return size;
275283
}
276284

285+
/// <summary>
286+
/// Called when the size of the element is allocated.
287+
/// Updates the corner clip for Mac Catalyst and non-Android/iOS platforms.
288+
/// </summary>
289+
/// <param name="width">The width allocated to the element.</param>
290+
/// <param name="height">The height allocated to the element.</param>
291+
protected override void OnSizeAllocated(double width, double height)
292+
{
293+
base.OnSizeAllocated(width, height);
294+
#if __MACCATALYST__ || (!__ANDROID__ && !__IOS__)
295+
this.ApplyCornerClip();
296+
#endif
297+
}
298+
277299
#endregion
278300

279301
#region Interface Implementation

0 commit comments

Comments
 (0)