Rename misleading DistanceSpacing variable

This commit is contained in:
Dean Herbert
2022-05-05 17:00:36 +09:00
parent 4226583afd
commit de9b3d33eb
4 changed files with 17 additions and 27 deletions

View File

@ -30,14 +30,14 @@ namespace osu.Game.Screens.Edit.Compose.Components
Position = StartPosition,
Width = crosshair_thickness,
EdgeSmoothness = new Vector2(1),
Height = Math.Min(crosshair_max_size, DistanceSpacing * 2),
Height = Math.Min(crosshair_max_size, DistanceBetweenTick * 2),
},
new Box
{
Origin = Anchor.Centre,
Position = StartPosition,
EdgeSmoothness = new Vector2(1),
Width = Math.Min(crosshair_max_size, DistanceSpacing * 2),
Width = Math.Min(crosshair_max_size, DistanceBetweenTick * 2),
Height = crosshair_thickness,
}
});
@ -45,11 +45,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
float dx = Math.Max(StartPosition.X, DrawWidth - StartPosition.X);
float dy = Math.Max(StartPosition.Y, DrawHeight - StartPosition.Y);
float maxDistance = new Vector2(dx, dy).Length;
int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceSpacing));
int requiredCircles = Math.Min(MaxIntervals, (int)(maxDistance / DistanceBetweenTick));
for (int i = 0; i < requiredCircles; i++)
{
float radius = (i + 1) * DistanceSpacing * 2;
float radius = (i + 1) * DistanceBetweenTick * 2;
AddInternal(new CircularProgress
{
@ -74,7 +74,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
float distance = direction.Length;
float radius = DistanceSpacing;
float radius = DistanceBetweenTick;
int radialCount = Math.Clamp((int)MathF.Round(distance / radius), 1, MaxIntervals);
Vector2 normalisedDirection = direction * new Vector2(1f / distance);

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary>
/// The spacing between each tick of the beat snapping grid.
/// </summary>
protected float DistanceSpacing { get; private set; }
protected float DistanceBetweenTick { get; private set; }
/// <summary>
/// The maximum number of distance snapping intervals allowed.
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary>
/// The position which the grid should start.
/// The first beat snapping tick is located at <see cref="StartPosition"/> + <see cref="DistanceSpacing"/> away from this point.
/// The first beat snapping tick is located at <see cref="StartPosition"/> + <see cref="DistanceBetweenTick"/> away from this point.
/// </summary>
protected readonly Vector2 StartPosition;
@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void updateSpacing()
{
DistanceSpacing = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value);
DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value);
if (endTime == null)
MaxIntervals = int.MaxValue;
@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
// +1 is added since a snapped hitobject may have its start time slightly less than the snapped time due to floating point errors
double maxDuration = endTime.Value - StartTime + 1;
MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceSpacing));
MaxIntervals = (int)(maxDuration / SnapProvider.DistanceToDuration(ReferenceObject, DistanceBetweenTick));
}
gridCache.Invalidate();