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

Expose DistanceSpacingMultiplier to distance

This commit is contained in:
Dean Herbert 2022-05-05 17:08:53 +09:00
parent de9b3d33eb
commit 786c7f14d3

View File

@ -25,6 +25,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// </summary>
protected float DistanceBetweenTick { get; private set; }
protected IBindable<double> DistanceSpacingMultiplier { get; private set; }
/// <summary>
/// The maximum number of distance snapping intervals allowed.
/// </summary>
@ -53,8 +55,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
[Resolved]
private BindableBeatDivisor beatDivisor { get; set; }
private IBindable<double> distanceSpacingMultiplier;
private readonly LayoutValue gridCache = new LayoutValue(Invalidation.RequiredParentSizeToFit);
private readonly double? endTime;
@ -86,13 +86,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
beatDivisor.BindValueChanged(_ => updateSpacing());
distanceSpacingMultiplier = SnapProvider.DistanceSpacingMultiplier.GetBoundCopy();
distanceSpacingMultiplier.BindValueChanged(_ => updateSpacing(), true);
DistanceSpacingMultiplier = SnapProvider.DistanceSpacingMultiplier.GetBoundCopy();
DistanceSpacingMultiplier.BindValueChanged(_ => updateSpacing(), true);
}
private void updateSpacing()
{
DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * distanceSpacingMultiplier.Value);
DistanceBetweenTick = (float)(SnapProvider.GetBeatSnapDistanceAt(ReferenceObject) * DistanceSpacingMultiplier.Value);
if (endTime == null)
MaxIntervals = int.MaxValue;