1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Offset start of distance snap grid drawing if reference object's start time doesn't align

Closes #20938.
This commit is contained in:
Dean Herbert 2022-10-26 13:10:39 +09:00
parent cab9a1c012
commit 2016d33055

View File

@ -53,9 +53,16 @@ namespace osu.Game.Screens.Edit.Compose.Components
float maxDistance = new Vector2(dx, dy).Length;
int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTicks));
// We need to offset the drawn lines to the next valid snap for the currently selected divisor.
//
// Picture the scenario where the user has just placed an object on a 1/2 snap, then changes to
// 1/3 snap and expects to be able to place the next object on a valid 1/3 snap, regardless of the
// fact that the 1/2 snap reference object is not valid for 1/3 snapping.
float offset = SnapProvider.FindSnappedDistance(ReferenceObject, 0);
for (int i = 0; i < requiredCircles; i++)
{
float diameter = (i + 1) * DistanceBetweenTicks * 2;
float diameter = (offset + (i + 1) * DistanceBetweenTicks) * 2;
AddInternal(new Ring(ReferenceObject, GetColourForIndexFromPlacement(i))
{