diff --git a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs index 345fe245fe..d6ddd4cc86 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneBeatSnapGrid.cs @@ -101,12 +101,12 @@ namespace osu.Game.Tests.Visual.Editor { createGrid(); - Vector2 screenSpacePosition = Vector2.Zero; - AddStep("get first tick position", () => screenSpacePosition = grid.ToScreenSpace(grid_position + new Vector2((float)beat_length, 0))); - AddAssert("snap time is 1 beat away", () => Precision.AlmostEquals(beat_length, grid.GetSnapTime(screenSpacePosition), 0.01)); + Vector2 snapPosition = Vector2.Zero; + AddStep("get first tick position", () => snapPosition = grid_position + new Vector2((float)beat_length, 0)); + AddAssert("snap time is 1 beat away", () => Precision.AlmostEquals(beat_length, grid.GetSnapTime(snapPosition), 0.01)); createGrid(g => g.Velocity = 2, "with velocity = 2"); - AddAssert("snap time is now 0.5 beats away", () => Precision.AlmostEquals(beat_length / 2, grid.GetSnapTime(screenSpacePosition), 0.01)); + AddAssert("snap time is now 0.5 beats away", () => Precision.AlmostEquals(beat_length / 2, grid.GetSnapTime(snapPosition), 0.01)); } private void createGrid(Action func = null, string description = null) diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs index 98ad0dd3e8..9040843144 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatSnapGrid.cs @@ -112,18 +112,18 @@ namespace osu.Game.Screens.Edit.Compose.Components protected abstract float GetVelocity(double time, ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty); /// - /// Snaps a screen-space position to this grid. + /// Snaps a position to this grid. /// - /// The original screen-space position. - /// The snapped screen-space position. - public abstract Vector2 GetSnapPosition(Vector2 screenSpacePosition); + /// The original position in coordinate space local to this . + /// The snapped position in coordinate space local to this . + public abstract Vector2 GetSnapPosition(Vector2 position); /// - /// Retrieves the time at a snapped screen-space position. + /// Retrieves the time at a snapped position. /// - /// The snapped screen-space position. + /// The snapped position in coordinate space local to this . /// The time at the snapped position. - public double GetSnapTime(Vector2 screenSpacePosition) => startTime + (ToLocalSpace(screenSpacePosition) - CentrePosition).Length / Velocity; + public double GetSnapTime(Vector2 position) => startTime + (position - CentrePosition).Length / Velocity; /// /// Retrieves the applicable colour for a beat index.