|
|
|
@ -1228,7 +1228,7 @@ namespace Avalonia.Controls |
|
|
|
Debug.Assert(1 < count && 0 <= start && (start + count) <= definitions.Count); |
|
|
|
|
|
|
|
// avoid processing when asked to distribute "0"
|
|
|
|
if (!_IsZero(requestedSize)) |
|
|
|
if (!MathUtilities.IsZero(requestedSize)) |
|
|
|
{ |
|
|
|
DefinitionBase[] tempDefinitions = TempDefinitions; // temp array used to remember definitions for sorting
|
|
|
|
int end = start + count; |
|
|
|
@ -1306,7 +1306,7 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
|
|
|
|
// sanity check: requested size must all be distributed
|
|
|
|
Debug.Assert(_IsZero(sizeToDistribute)); |
|
|
|
Debug.Assert(MathUtilities.IsZero(sizeToDistribute)); |
|
|
|
} |
|
|
|
else if (requestedSize <= rangeMaxSize) |
|
|
|
{ |
|
|
|
@ -1346,7 +1346,7 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
|
|
|
|
// sanity check: requested size must all be distributed
|
|
|
|
Debug.Assert(_IsZero(sizeToDistribute)); |
|
|
|
Debug.Assert(MathUtilities.IsZero(sizeToDistribute)); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -1358,7 +1358,7 @@ namespace Avalonia.Controls |
|
|
|
double equalSize = requestedSize / count; |
|
|
|
|
|
|
|
if (equalSize < maxMaxSize |
|
|
|
&& !_AreClose(equalSize, maxMaxSize)) |
|
|
|
&& !MathUtilities.AreClose(equalSize, maxMaxSize)) |
|
|
|
{ |
|
|
|
// equi-size is less than maximum of maxSizes.
|
|
|
|
// in this case distribute so that smaller definitions grow faster than
|
|
|
|
@ -2151,7 +2151,7 @@ namespace Avalonia.Controls |
|
|
|
// and precision of floating-point computation. (However, the resulting
|
|
|
|
// display is subject to anti-aliasing problems. TANSTAAFL.)
|
|
|
|
|
|
|
|
if (!_AreClose(roundedTakenSize, finalSize)) |
|
|
|
if (!MathUtilities.AreClose(roundedTakenSize, finalSize)) |
|
|
|
{ |
|
|
|
// Compute deltas
|
|
|
|
for (int i = 0; i < definitions.Count; ++i) |
|
|
|
@ -2168,7 +2168,7 @@ namespace Avalonia.Controls |
|
|
|
if (roundedTakenSize > finalSize) |
|
|
|
{ |
|
|
|
int i = definitions.Count - 1; |
|
|
|
while ((adjustedSize > finalSize && !_AreClose(adjustedSize, finalSize)) && i >= 0) |
|
|
|
while ((adjustedSize > finalSize && !MathUtilities.AreClose(adjustedSize, finalSize)) && i >= 0) |
|
|
|
{ |
|
|
|
DefinitionBase definition = definitions[definitionIndices[i]]; |
|
|
|
double final = definition.SizeCache - dpiIncrement; |
|
|
|
@ -2184,7 +2184,7 @@ namespace Avalonia.Controls |
|
|
|
else if (roundedTakenSize < finalSize) |
|
|
|
{ |
|
|
|
int i = 0; |
|
|
|
while ((adjustedSize < finalSize && !_AreClose(adjustedSize, finalSize)) && i < definitions.Count) |
|
|
|
while ((adjustedSize < finalSize && !MathUtilities.AreClose(adjustedSize, finalSize)) && i < definitions.Count) |
|
|
|
{ |
|
|
|
DefinitionBase definition = definitions[definitionIndices[i]]; |
|
|
|
double final = definition.SizeCache + dpiIncrement; |
|
|
|
@ -2595,27 +2595,6 @@ namespace Avalonia.Controls |
|
|
|
set { SetFlags(value, Flags.HasGroup3CellsInAutoRows); } |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// fp version of <c>d == 0</c>.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="d">Value to check.</param>
|
|
|
|
/// <returns><c>true</c> if d == 0.</returns>
|
|
|
|
private static bool _IsZero(double d) |
|
|
|
{ |
|
|
|
return (Math.Abs(d) < double.Epsilon); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// fp version of <c>d1 == d2</c>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="d1">First value to compare</param>
|
|
|
|
/// <param name="d2">Second value to compare</param>
|
|
|
|
/// <returns><c>true</c> if d1 == d2</returns>
|
|
|
|
private static bool _AreClose(double d1, double d2) |
|
|
|
{ |
|
|
|
return (Math.Abs(d1 - d2) < double.Epsilon); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Returns reference to extended data bag.
|
|
|
|
/// </summary>
|
|
|
|
|