From ac9cdda48c7f39179097935940d0bb0e62ccabb4 Mon Sep 17 00:00:00 2001 From: Giuseppe Lippolis Date: Fri, 14 Oct 2022 14:42:39 +0200 Subject: [PATCH] fix: Missing CA1802 --- .../Platform/Specific/Helpers/AndroidMotionEventsHelper.cs | 6 +++--- src/Avalonia.Base/Utilities/MathUtilities.cs | 2 +- .../Media/TextFormatting/TextLineTests.cs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidMotionEventsHelper.cs b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidMotionEventsHelper.cs index ce385ebe34..6d0e6be0ad 100644 --- a/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidMotionEventsHelper.cs +++ b/src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidMotionEventsHelper.cs @@ -15,7 +15,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers internal class AndroidMotionEventsHelper : IDisposable { private static readonly PooledList s_intermediatePointsPooledList = new(ClearMode.Never); - private static readonly float s_radiansToDegree = (float)(180f * Math.PI); + private const float RadiansToDegree = (float)(180f * Math.PI); private readonly TouchDevice _touchDevice; private readonly MouseDevice _mouseDevice; private readonly PenDevice _penDevice; @@ -223,7 +223,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers { Position = new Point(e.GetX(index), e.GetY(index)) / _view.RenderScaling, Pressure = Math.Min(e.GetPressure(index), 1), // android pressure can depend on the device, can be mixed up with "GetSize", may be larger than 1.0f on some devices - Twist = e.GetOrientation(index) * s_radiansToDegree + Twist = e.GetOrientation(index) * RadiansToDegree }; } @@ -233,7 +233,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers { Position = new Point(e.GetHistoricalX(index, pos), e.GetHistoricalY(index, pos)) / _view.RenderScaling, Pressure = Math.Min(e.GetHistoricalPressure(index, pos), 1), - Twist = e.GetHistoricalOrientation(index, pos) * s_radiansToDegree + Twist = e.GetHistoricalOrientation(index, pos) * RadiansToDegree }; } diff --git a/src/Avalonia.Base/Utilities/MathUtilities.cs b/src/Avalonia.Base/Utilities/MathUtilities.cs index 3c48c3469e..feb1097b5f 100644 --- a/src/Avalonia.Base/Utilities/MathUtilities.cs +++ b/src/Avalonia.Base/Utilities/MathUtilities.cs @@ -11,7 +11,7 @@ namespace Avalonia.Utilities static class MathUtilities { // smallest such that 1.0+DoubleEpsilon != 1.0 - internal static readonly double DoubleEpsilon = 2.2204460492503131e-016; + internal const double DoubleEpsilon = 2.2204460492503131e-016; private const float FloatEpsilon = 1.192092896e-07F; diff --git a/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs b/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs index 251c850fc8..33c18c5064 100644 --- a/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs +++ b/tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs @@ -12,7 +12,7 @@ namespace Avalonia.Skia.UnitTests.Media.TextFormatting { public class TextLineTests { - private static readonly string s_multiLineText = "012345678\r\r0123456789"; + private const string s_multiLineText = "012345678\r\r0123456789"; [Fact] public void Should_Get_First_CharacterHit()