Skip to content

Commit

Permalink
fix(calendar): Fix background not applied properly on all items
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Jun 1, 2021
1 parent ab3ccb6 commit ec1c39f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ private Size base_MeasureOverride(Size availableSize)
{
var pixelsPerRow = viewport.Height / Rows;
renderWindow.Y = Math.Max(0, renderWindow.Y - pixelsPerRow);
renderWindow.Height = renderWindow.Height + pixelsPerRow;
renderWindow.Height = renderWindow.Height + (2 * pixelsPerRow);
}

// Prepare the items generator to generate some new items (will also set which items can be recycled in this measure pass).
Expand Down Expand Up @@ -549,7 +549,7 @@ private Size base_MeasureOverride(Size availableSize)
break;
}

var isVisible = viewport.Contains(itemBounds.Location);
var isVisible = itemBounds.IsIntersecting(viewport);
if (firstVisibleIndex == -1 && isVisible)
{
firstVisibleIndex = index;
Expand Down
6 changes: 6 additions & 0 deletions src/Uno.UWP/Extensions/RectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,11 @@ internal static Rect OffsetRect(this Rect rect, double dx, double dy)
}

internal static Rect OffsetRect(this Rect rect, Point offset) => rect.OffsetRect(offset.X, offset.Y);

internal static bool IsIntersecting(this Rect rect, Rect other)
{
rect.Intersect(other);
return !rect.IsEmpty;
}
}
}

0 comments on commit ec1c39f

Please sign in to comment.