feat: update dependency, replace obsoleted math utilities.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Utilities;
|
||||
using Irihi.Avalonia.Shared.Helpers;
|
||||
using static System.Math;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
@@ -132,7 +133,7 @@ public class ElasticWrapPanel : WrapPanel
|
||||
sz.V = itemSetSize.V;
|
||||
}
|
||||
|
||||
if (MathUtilities.GreaterThan(curLineSize.U + sz.U, uvConstraint.U))
|
||||
if (MathHelpers.GreaterThan(curLineSize.U + sz.U, uvConstraint.U))
|
||||
{
|
||||
panelSize.U = Max(curLineSize.U, panelSize.U);
|
||||
panelSize.V += curLineSize.V;
|
||||
@@ -158,13 +159,13 @@ public class ElasticWrapPanel : WrapPanel
|
||||
itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||
itemHeightSet ? itemHeight : child.DesiredSize.Height);
|
||||
|
||||
if (MathUtilities.GreaterThan(curLineSize.U + sz.U, uvConstraint.U)) // Need to switch to another line
|
||||
if (MathHelpers.GreaterThan(curLineSize.U + sz.U, uvConstraint.U)) // Need to switch to another line
|
||||
{
|
||||
panelSize.U = Max(curLineSize.U, panelSize.U);
|
||||
panelSize.V += curLineSize.V;
|
||||
curLineSize = sz;
|
||||
|
||||
if (MathUtilities.GreaterThan(sz.U, uvConstraint.U)) // The element is wider than the constraint - give it a separate line
|
||||
if (MathHelpers.GreaterThan(sz.U, uvConstraint.U)) // The element is wider than the constraint - give it a separate line
|
||||
{
|
||||
panelSize.U = Max(sz.U, panelSize.U);
|
||||
panelSize.V += sz.V;
|
||||
@@ -236,7 +237,7 @@ public class ElasticWrapPanel : WrapPanel
|
||||
sz.V = itemSetSize.V;
|
||||
}
|
||||
|
||||
if (MathUtilities.GreaterThan(curLineUIs.TotalU + sz.U, uvFinalSize.U))
|
||||
if (MathHelpers.GreaterThan(curLineUIs.TotalU + sz.U, uvFinalSize.U))
|
||||
{
|
||||
if (curLineUIs.Count > 0)
|
||||
{
|
||||
@@ -260,7 +261,7 @@ public class ElasticWrapPanel : WrapPanel
|
||||
itemWidthSet ? ItemWidth : child.DesiredSize.Width,
|
||||
itemHeightSet ? ItemHeight : child.DesiredSize.Height);
|
||||
|
||||
if (MathUtilities.GreaterThan(curLineUIs.TotalU + sz.U, uvFinalSize.U)) // Need to switch to another line
|
||||
if (MathHelpers.GreaterThan(curLineUIs.TotalU + sz.U, uvFinalSize.U)) // Need to switch to another line
|
||||
{
|
||||
if (curLineUIs.Count > 0)
|
||||
{
|
||||
@@ -269,7 +270,7 @@ public class ElasticWrapPanel : WrapPanel
|
||||
|
||||
curLineUIs = new UVCollection(Orientation, itemSetSize);
|
||||
curLineUIs.Add(child, sz);
|
||||
if (MathUtilities.GreaterThan(sz.U, uvFinalSize.U))
|
||||
if (MathHelpers.GreaterThan(sz.U, uvFinalSize.U))
|
||||
{
|
||||
lineUVCollection.Add(curLineUIs);
|
||||
curLineUIs = new UVCollection(Orientation, itemSetSize);
|
||||
|
||||
@@ -540,7 +540,7 @@ public class IPv4Box: TemplatedControl
|
||||
IClipboard? clipboard = TopLevel.GetTopLevel(this)?.Clipboard;
|
||||
if (clipboard is null) return;
|
||||
var s = await clipboard.GetTextAsync();
|
||||
if (IPAddress.TryParse(s, out var address))
|
||||
if (s is not null && IPAddress.TryParse(s, out var address))
|
||||
{
|
||||
IPAddress = address;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Utilities;
|
||||
using Irihi.Avalonia.Shared.Helpers;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -239,27 +239,27 @@ public class RangeSlider: TemplatedControl
|
||||
{
|
||||
foreach (var tick in ticks)
|
||||
{
|
||||
if (MathUtilities.AreClose(tick, value))
|
||||
if (MathHelpers.AreClose(tick, value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if (MathUtilities.LessThan(tick, value) && MathUtilities.GreaterThan(tick, previous))
|
||||
if (MathHelpers.LessThan(tick, value) && MathHelpers.GreaterThan(tick, previous))
|
||||
{
|
||||
previous = tick;
|
||||
}
|
||||
else if (MathUtilities.GreaterThan(tick, value) && MathUtilities.LessThan(tick, next))
|
||||
else if (MathHelpers.GreaterThan(tick, value) && MathHelpers.LessThan(tick, next))
|
||||
{
|
||||
next = tick;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (MathUtilities.GreaterThan(TickFrequency, 0.0))
|
||||
else if (MathHelpers.GreaterThan(TickFrequency, 0.0))
|
||||
{
|
||||
previous = Minimum + Math.Round((value - Minimum) / TickFrequency) * TickFrequency;
|
||||
next = Math.Min(Maximum, previous + TickFrequency);
|
||||
}
|
||||
value = MathUtilities.GreaterThanOrClose(value, (previous + next) * 0.5) ? next : previous;
|
||||
value = MathHelpers.GreaterThanOrClose(value, (previous + next) * 0.5) ? next : previous;
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Utilities;
|
||||
using Irihi.Avalonia.Shared.Helpers;
|
||||
|
||||
namespace Ursa.Controls;
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TagInputPanel: Panel
|
||||
child.Measure(availableSize);
|
||||
double deltaX = availableSize.Width - currentLineX;
|
||||
// Width is enough to place next child
|
||||
if (MathUtilities.GreaterThan(deltaX, child.DesiredSize.Width))
|
||||
if (MathHelpers.GreaterThan(deltaX, child.DesiredSize.Width))
|
||||
{
|
||||
currentLineX+=child.DesiredSize.Width;
|
||||
currentLineHeight = Math.Max(currentLineHeight, child.DesiredSize.Height);
|
||||
@@ -69,7 +69,7 @@ public class TagInputPanel: Panel
|
||||
var child = children[i];
|
||||
double deltaX = finalSize.Width - currentLineX;
|
||||
// Width is enough to place next child
|
||||
if (MathUtilities.GreaterThan(deltaX, child.DesiredSize.Width))
|
||||
if (MathHelpers.GreaterThan(deltaX, child.DesiredSize.Width))
|
||||
{
|
||||
child.Arrange(new Rect(currentLineX, totalHeight, child.DesiredSize.Width, Math.Max(child.DesiredSize.Height, currentLineHeight)));
|
||||
currentLineX += child.DesiredSize.Width;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="$(AvaloniaVersion)"/>
|
||||
<PackageReference Include="Irihi.Avalonia.Shared" Version="0.1.8" />
|
||||
<PackageReference Include="Irihi.Avalonia.Shared" Version="0.1.9" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user