Skip to content

Commit

Permalink
Fix MoveAnimation animation is not triggered when opening with PopupN…
Browse files Browse the repository at this point in the history
…avigation.Instance.PushAsync #15
  • Loading branch information
microspaze committed May 16, 2024
1 parent a884b5f commit 6fdcd2e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions RGPopup.Maui/Animations/Base/BaseAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,16 @@ public abstract class BaseAnimation : IPopupAnimation

protected virtual int GetTopOffset(View content, Page page)
{
return (int)(content.Height + page.Height) / 2;
var pageHeight = page.Height;
var contentHeight = content.Height;
return pageHeight > 0 && contentHeight > 0 ? (int)(contentHeight + pageHeight) / 2 : (int)page.Window.Height;
}

protected virtual int GetLeftOffset(View content, Page page)
{
return (int)(content.Width + page.Width) / 2;
var pageWidth = page.Width;
var contentWidth = content.Width;
return pageWidth > 0 && contentWidth > 0 ? (int)(contentWidth + pageWidth) / 2 : (int)page.Window.Width;
}

/// <summary>
Expand Down

0 comments on commit 6fdcd2e

Please sign in to comment.