Skip to content

Commit

Permalink
fix(calendar): Fix first date always top/left
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Jun 1, 2021
1 parent 9d22bd6 commit 4702c59
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ private Size base_MeasureOverride(Size availableSize)
// Gets the index of the first element to render and the actual viewport to use
_layoutStrategy.EstimateElementIndex(ElementType.ItemContainer, default, default, viewport, out var renderWindow, out var startIndex);
renderWindow.Size = viewport.Size; // The actualViewport contains only position information
startIndex = Math.Max(0, startIndex - StartIndex);

// We request to the algo to render an extra row before and after the actual viewport
if (Rows > 0) // This can occur on first measure when we only determine the biggest item size
Expand Down Expand Up @@ -527,7 +528,7 @@ private Size base_MeasureOverride(Size availableSize)
}

var itemSize = _layoutStrategy.GetElementMeasureSize(ElementType.ItemContainer, index, renderWindow); // Note: It's actually the same for all items
var itemBounds = _layoutStrategy.GetElementBounds(ElementType.ItemContainer, index, itemSize, layout, renderWindow);
var itemBounds = _layoutStrategy.GetElementBounds(ElementType.ItemContainer, index + StartIndex, itemSize, layout, renderWindow);

if (itemSize.Width < _minCellSize.Width && itemSize.Height < _minCellSize.Height)
{
Expand Down Expand Up @@ -577,7 +578,6 @@ private Size base_MeasureOverride(Size availableSize)
index++;
}

StartIndex = 0;
FirstVisibleIndexBase = Math.Max(firstVisibleIndex, startIndex);
LastVisibleIndexBase = Math.Max(FirstVisibleIndexBase, lastVisibleIndex);
_lastLayoutedViewport = viewport;
Expand Down Expand Up @@ -628,7 +628,7 @@ private Size base_ArrangeOverride(Size finalSize)
foreach (var child in Children)
{
var index = _cache.IndexFromContainer(child);
var bounds = _layoutStrategy.GetElementBounds(ElementType.ItemContainer, index, child.DesiredSize, layout, window);
var bounds = _layoutStrategy.GetElementBounds(ElementType.ItemContainer, index + StartIndex, child.DesiredSize, layout, window);

//TODO _layoutStrategy.GetElementArrangeBounds()

Expand Down

0 comments on commit 4702c59

Please sign in to comment.