Skip to content

Commit 2016d33

Browse files
committed
Offset start of distance snap grid drawing if reference object's start time doesn't align
Closes ppy#20938.
1 parent cab9a1c commit 2016d33

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ protected override void CreateContent()
5353
float maxDistance = new Vector2(dx, dy).Length;
5454
int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTicks));
5555

56+
// We need to offset the drawn lines to the next valid snap for the currently selected divisor.
57+
//
58+
// Picture the scenario where the user has just placed an object on a 1/2 snap, then changes to
59+
// 1/3 snap and expects to be able to place the next object on a valid 1/3 snap, regardless of the
60+
// fact that the 1/2 snap reference object is not valid for 1/3 snapping.
61+
float offset = SnapProvider.FindSnappedDistance(ReferenceObject, 0);
62+
5663
for (int i = 0; i < requiredCircles; i++)
5764
{
58-
float diameter = (i + 1) * DistanceBetweenTicks * 2;
65+
float diameter = (offset + (i + 1) * DistanceBetweenTicks) * 2;
5966

6067
AddInternal(new Ring(ReferenceObject, GetColourForIndexFromPlacement(i))
6168
{

0 commit comments

Comments
 (0)