1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 12:53:11 +08:00

Improve precision for repeat edges

This commit is contained in:
Naxess 2021-06-27 03:26:35 +02:00
parent 2cd7eda3c4
commit 4cfa0ae5ec

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Utils;
@ -96,7 +97,9 @@ namespace osu.Game.Rulesets.Edit.Checks
if (hitObject is IHasRepeats hasRepeats)
{
double spanDuration = hasRepeats.Duration / hasRepeats.SpanCount();
if (Precision.AlmostEquals((time - hitObject.StartTime) % spanDuration, 0f, 1f))
double spans = (time - hitObject.StartTime) / spanDuration;
if (Precision.AlmostEquals(spans, Math.Ceiling(spans)) || Precision.AlmostEquals(spans, Math.Floor(spans)))
return EdgeType.Repeat;
}