Skip to content

Commit 088b1c9

Browse files
committed
changed Row to struct
1 parent 14fc908 commit 088b1c9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel/WrapPanel.Data.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ public Rect ToRect(Orientation orientation)
6666
}
6767
}
6868

69-
private class Row
69+
private struct Row
7070
{
7171
private readonly List<UvRect> _childrenRects;
7272
private UvMeasure _rowSize;
7373

74-
public Row()
74+
public Row(List<UvRect> childrenRects, UvMeasure size)
7575
{
76-
_childrenRects = new List<UvRect>();
77-
_rowSize = UvMeasure.Zero;
76+
_childrenRects = childrenRects;
77+
_rowSize = size;
7878
}
7979

8080
public IReadOnlyList<UvRect> ChildrenRects => _childrenRects;
@@ -87,7 +87,7 @@ public Row()
8787
public void Add(UvMeasure position, UvMeasure size)
8888
{
8989
_childrenRects.Add(new UvRect { Position = position, Size = size });
90-
_rowSize.U = Math.Max(_rowSize.U, position.U + size.U);
90+
_rowSize.U = position.U + size.U;
9191
_rowSize.V = Math.Max(_rowSize.V, size.V);
9292
}
9393
}

Microsoft.Toolkit.Uwp.UI.Controls/WrapPanel/WrapPanel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ protected override Size ArrangeOverride(Size finalSize)
209209
var paddingEnd = new UvMeasure(Orientation, Padding.Right, Padding.Bottom);
210210
var position = new UvMeasure(Orientation, Padding.Left, Padding.Top);
211211

212-
var currentRow = new Row();
212+
var currentRow = new Row(new List<UvRect>(), default);
213213
void Arrange(UIElement child, bool isLast = false)
214214
{
215215
var desiredMeasure = new UvMeasure(Orientation, child.DesiredSize);
@@ -225,7 +225,7 @@ void Arrange(UIElement child, bool isLast = false)
225225
position.V += currentRow.Size.V + spacingMeasure.V;
226226

227227
rows.Add(currentRow);
228-
currentRow = new Row();
228+
currentRow = new Row(new List<UvRect>(), default);
229229
}
230230

231231
// Stretch the last item to fill the available space

0 commit comments

Comments
 (0)