Browse Source

fix: Missing CA1802

pull/9185/head
Giuseppe Lippolis 4 years ago
parent
commit
ac9cdda48c
  1. 6
      src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidMotionEventsHelper.cs
  2. 2
      src/Avalonia.Base/Utilities/MathUtilities.cs
  3. 2
      tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs

6
src/Android/Avalonia.Android/Platform/Specific/Helpers/AndroidMotionEventsHelper.cs

@ -15,7 +15,7 @@ namespace Avalonia.Android.Platform.Specific.Helpers
internal class AndroidMotionEventsHelper : IDisposable internal class AndroidMotionEventsHelper : IDisposable
{ {
private static readonly PooledList<RawPointerPoint> s_intermediatePointsPooledList = new(ClearMode.Never); private static readonly PooledList<RawPointerPoint> 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 TouchDevice _touchDevice;
private readonly MouseDevice _mouseDevice; private readonly MouseDevice _mouseDevice;
private readonly PenDevice _penDevice; 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, 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 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, Position = new Point(e.GetHistoricalX(index, pos), e.GetHistoricalY(index, pos)) / _view.RenderScaling,
Pressure = Math.Min(e.GetHistoricalPressure(index, pos), 1), Pressure = Math.Min(e.GetHistoricalPressure(index, pos), 1),
Twist = e.GetHistoricalOrientation(index, pos) * s_radiansToDegree Twist = e.GetHistoricalOrientation(index, pos) * RadiansToDegree
}; };
} }

2
src/Avalonia.Base/Utilities/MathUtilities.cs

@ -11,7 +11,7 @@ namespace Avalonia.Utilities
static class MathUtilities static class MathUtilities
{ {
// smallest such that 1.0+DoubleEpsilon != 1.0 // 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; private const float FloatEpsilon = 1.192092896e-07F;

2
tests/Avalonia.Skia.UnitTests/Media/TextFormatting/TextLineTests.cs

@ -12,7 +12,7 @@ namespace Avalonia.Skia.UnitTests.Media.TextFormatting
{ {
public class TextLineTests public class TextLineTests
{ {
private static readonly string s_multiLineText = "012345678\r\r0123456789"; private const string s_multiLineText = "012345678\r\r0123456789";
[Fact] [Fact]
public void Should_Get_First_CharacterHit() public void Should_Get_First_CharacterHit()

Loading…
Cancel
Save