@@ -20,7 +20,6 @@ protected override Size MeasureOverride(Size availableSize)
2020
2121 // Define XY/UV coordinate variables
2222 var uvAvailableSize = new UVCoord ( availableSize . Width , availableSize . Height , Orientation ) ;
23- var uvSpacing = new UVCoord ( HorizontalSpacing , VerticalSpacing , Orientation ) ;
2423
2524 RowSpec currentRowSpec = default ;
2625
@@ -41,7 +40,7 @@ protected override Size MeasureOverride(Size availableSize)
4140
4241 // Attempt to add the child to the current row/column
4342 var spec = new RowSpec ( layoutLength , uvDesiredSize ) ;
44- if ( ! currentRowSpec . TryAdd ( spec , uvSpacing . U , uvAvailableSize . U ) )
43+ if ( ! currentRowSpec . TryAdd ( spec , ItemSpacing , uvAvailableSize . U ) )
4544 {
4645 // If the overflow behavior is drop, just end the row here.
4746 if ( OverflowBehavior is OverflowBehavior . Drop )
@@ -50,20 +49,20 @@ protected override Size MeasureOverride(Size availableSize)
5049 // Could not add to current row/column
5150 // Start a new row/column
5251 _rowSpecs . Add ( currentRowSpec ) ;
53- _longestRowSize = Math . Max ( _longestRowSize , currentRowSpec . Measure ( uvSpacing . U ) ) ;
52+ _longestRowSize = Math . Max ( _longestRowSize , currentRowSpec . Measure ( ItemSpacing ) ) ;
5453 currentRowSpec = spec ;
5554 }
5655 }
5756
5857 // Add the final row/column
5958 _rowSpecs . Add ( currentRowSpec ) ;
60- _longestRowSize = Math . Max ( _longestRowSize , currentRowSpec . Measure ( uvSpacing . U ) ) ;
59+ _longestRowSize = Math . Max ( _longestRowSize , currentRowSpec . Measure ( ItemSpacing ) ) ;
6160
6261 // Calculate final desired size
6362 var uvSize = new UVCoord ( 0 , 0 , Orientation )
6463 {
6564 U = IsMainAxisStretch ( uvAvailableSize . U ) ? uvAvailableSize . U : _longestRowSize ,
66- V = _rowSpecs . Sum ( static rs => rs . MaxOffAxisSize ) + ( uvSpacing . V * ( _rowSpecs . Count - 1 ) )
65+ V = _rowSpecs . Sum ( static rs => rs . MaxOffAxisSize ) + ( LineSpacing * ( _rowSpecs . Count - 1 ) )
6766 } ;
6867
6968 // Clamp to available size and return
@@ -82,18 +81,17 @@ protected override Size ArrangeOverride(Size finalSize)
8281 // Create XY/UV coordinate variables
8382 var pos = new UVCoord ( 0 , 0 , Orientation ) ;
8483 var uvFinalSize = new UVCoord ( finalSize , Orientation ) ;
85- var uvSpacing = new UVCoord ( HorizontalSpacing , VerticalSpacing , Orientation ) ;
8684
8785 // Adjust the starting position based on off-axis alignment
88- var contentHeight = _rowSpecs . Sum ( static rs => rs . MaxOffAxisSize ) + ( uvSpacing . V * ( _rowSpecs . Count - 1 ) ) ;
86+ var contentHeight = _rowSpecs . Sum ( static rs => rs . MaxOffAxisSize ) + ( LineSpacing * ( _rowSpecs . Count - 1 ) ) ;
8987 pos . V = GetStartByAlignment ( GetOffAlignment ( ) , contentHeight , uvFinalSize . V ) ;
9088
9189 var childQueue = new Queue < UIElement > ( Children . Where ( static e => e . Visibility is Visibility . Visible ) ) ;
9290
9391 foreach ( var row in _rowSpecs )
9492 {
9593 // Arrange the row/column
96- ArrangeRow ( ref pos , row , uvFinalSize , uvSpacing , childQueue ) ;
94+ ArrangeRow ( ref pos , row , uvFinalSize , childQueue ) ;
9795 }
9896
9997 // "Arrange" remaning children by rendering them with zero size
@@ -106,9 +104,9 @@ protected override Size ArrangeOverride(Size finalSize)
106104 return finalSize ;
107105 }
108106
109- private void ArrangeRow ( ref UVCoord pos , RowSpec row , UVCoord uvFinalSize , UVCoord uvSpacing , Queue < UIElement > childQueue )
107+ private void ArrangeRow ( ref UVCoord pos , RowSpec row , UVCoord uvFinalSize , Queue < UIElement > childQueue )
110108 {
111- var spacingTotalSize = uvSpacing . U * ( row . ItemsCount - 1 ) ;
109+ var spacingTotalSize = ItemSpacing * ( row . ItemsCount - 1 ) ;
112110 var remainingSpace = uvFinalSize . U - row . ReservedSpace - spacingTotalSize ;
113111 var portionSize = row . MinPortionSize ;
114112
@@ -130,7 +128,7 @@ private void ArrangeRow(ref UVCoord pos, RowSpec row, UVCoord uvFinalSize, UVCoo
130128 // Also do this if there are no star-sized items in the row/column and no forced streching is in use.
131129 if ( ! stretch || ( row . PortionsSum is 0 && ForcedStretchMethod is ForcedStretchMethod . None ) )
132130 {
133- var rowSize = row . Measure ( uvSpacing . U ) ;
131+ var rowSize = row . Measure ( ItemSpacing ) ;
134132 pos . U = GetStartByAlignment ( GetAlignment ( ) , rowSize , uvFinalSize . U ) ;
135133 }
136134
@@ -184,11 +182,11 @@ private void ArrangeRow(ref UVCoord pos, RowSpec row, UVCoord uvFinalSize, UVCoo
184182 child . Arrange ( new Rect ( pos . X , pos . Y , size . X , size . Y ) ) ;
185183
186184 // Advance the position
187- pos . U += size . U + uvSpacing . U ;
185+ pos . U += size . U + ItemSpacing ;
188186 }
189187
190188 // Advance to the next row/column
191- pos . V += row . MaxOffAxisSize + uvSpacing . V ;
189+ pos . V += row . MaxOffAxisSize + LineSpacing ;
192190 }
193191
194192 private UVCoord GetChildSize ( UIElement child , int indexInRow , RowSpec row , double portionSize , bool forceStretch )
0 commit comments