Fix multiple warnings

This commit is contained in:
Stone_Red
2024-11-15 19:41:16 +01:00
parent 7e1736696d
commit 3993e6d612
7 changed files with 41 additions and 34 deletions
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Drawing;
@@ -6,6 +7,8 @@ namespace DesktopMagic.Api.Drawing;
internal class FontComparer : IEqualityComparer<Font>
{
private const float Tolerance = 0.01f;
public bool Equals(Font? font1, Font? font2)
{
if (font1 is null || font2 is null)
@@ -18,7 +21,7 @@ internal class FontComparer : IEqualityComparer<Font>
return false;
}
if (font1.SizeInPoints != font2.SizeInPoints)
if (Math.Abs(font1.SizeInPoints - font2.SizeInPoints) > Tolerance)
{
return false;
}
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
namespace DesktopMagic.Api.Settings;
@@ -22,6 +23,7 @@ public sealed class Slider : Setting
/// <summary>
/// Gets or sets the value assigned to the <see cref="Slider"/> element.
/// </summary>
[SuppressMessage("Major Bug", "S1244:Floating point numbers should not be tested for equality", Justification = "Not applicable here since we want to detect changes in the value.")]
public double Value
{
get => _value;