Use AlmostEquals

This commit is contained in:
vmaggioli 2021-01-20 13:00:25 -05:00
parent d42773ebb2
commit 5ee3a5f230
No known key found for this signature in database
GPG Key ID: 5E31099CCBAEA383

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -387,7 +388,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
case IHasDuration endTimeHitObject: case IHasDuration endTimeHitObject:
var snappedTime = Math.Max(hitObject.StartTime, beatSnapProvider.SnapTime(time)); var snappedTime = Math.Max(hitObject.StartTime, beatSnapProvider.SnapTime(time));
if (endTimeHitObject.EndTime == snappedTime || (snappedTime - hitObject.StartTime) < 1) if (endTimeHitObject.EndTime == snappedTime || Precision.AlmostEquals(snappedTime, hitObject.StartTime, 1))
return; return;
endTimeHitObject.Duration = snappedTime - hitObject.StartTime; endTimeHitObject.Duration = snappedTime - hitObject.StartTime;