diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs index da7708081b..6b8daa531f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneOsuDistanceSnapGrid.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -14,6 +15,7 @@ using osu.Game.Rulesets.Osu.Beatmaps; using osu.Game.Rulesets.Osu.Edit; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit; +using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Tests.Visual; using osuTK; using osuTK.Graphics; @@ -25,6 +27,11 @@ namespace osu.Game.Rulesets.Osu.Tests private const double beat_length = 100; private static readonly Vector2 grid_position = new Vector2(512, 384); + public override IReadOnlyList RequiredTypes => new[] + { + typeof(CircularDistanceSnapGrid) + }; + [Cached(typeof(IEditorBeatmap))] private readonly EditorBeatmap editorBeatmap; diff --git a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs index 3cbf926d4f..17b2eedb6e 100644 --- a/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/CircularDistanceSnapGrid.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Game.Rulesets.Objects; using osuTK; @@ -18,6 +19,22 @@ namespace osu.Game.Screens.Edit.Compose.Components protected override void CreateContent(Vector2 centrePosition) { + AddInternal(new Box + { + Origin = Anchor.Centre, + Position = centrePosition, + Width = 2, + Height = Math.Min(10, DistanceSpacing * 2), + }); + + AddInternal(new Box + { + Origin = Anchor.Centre, + Position = centrePosition, + Width = Math.Min(10, DistanceSpacing * 2), + Height = 2, + }); + float dx = Math.Max(centrePosition.X, DrawWidth - centrePosition.X); float dy = Math.Max(centrePosition.Y, DrawHeight - centrePosition.Y); float maxDistance = new Vector2(dx, dy).Length; diff --git a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs index 299e78b7c0..096ff0a6dd 100644 --- a/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/DistanceSnapGrid.cs @@ -36,15 +36,15 @@ namespace osu.Game.Screens.Edit.Compose.Components /// protected readonly Vector2 CentrePosition; + [Resolved] + protected OsuColour Colours { get; private set; } + [Resolved] private IEditorBeatmap beatmap { get; set; } [Resolved] private BindableBeatDivisor beatDivisor { get; set; } - [Resolved] - private OsuColour colours { get; set; } - private readonly Cached gridCache = new Cached(); private readonly HitObject hitObject; @@ -136,7 +136,7 @@ namespace osu.Game.Screens.Edit.Compose.Components protected ColourInfo GetColourForBeatIndex(int index) { int beat = (index + 1) % beatDivisor.Value; - ColourInfo colour = colours.Gray5; + ColourInfo colour = Colours.Gray5; for (int i = 0; i < BindableBeatDivisor.VALID_DIVISORS.Length; i++) { @@ -144,7 +144,7 @@ namespace osu.Game.Screens.Edit.Compose.Components if ((beat * divisor) % beatDivisor.Value == 0) { - colour = BindableBeatDivisor.GetColourFor(divisor, colours); + colour = BindableBeatDivisor.GetColourFor(divisor, Colours); break; } }