From 865be5a10b1405c185e80a9c32ca7bb2ee57bc23 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 26 Oct 2021 11:00:44 +0900 Subject: [PATCH] Fix distance snap grid rendering inverted when out of bounds --- osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs b/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs index 1b9705e8dc..db7b910f96 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchDistanceSnapGrid.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; @@ -63,9 +64,11 @@ namespace osu.Game.Rulesets.Catch.Edit for (int i = 0; i < velocities.Length; i++) { double velocity = velocities[i]; + var verticalPath = verticalPaths[i]; // The line ends at the top of the screen. - double endTime = hitObjectContainer.TimeAtPosition(-hitObjectContainer.DrawHeight, hitObjectContainer.Time.Current); + double topScreenTime = hitObjectContainer.TimeAtPosition(-hitObjectContainer.DrawHeight, hitObjectContainer.Time.Current); + double endTime = Math.Max(StartTime, topScreenTime); float x = (float)((endTime - StartTime) * velocity); float y = hitObjectContainer.PositionAtTime(endTime, StartTime); @@ -74,7 +77,6 @@ namespace osu.Game.Rulesets.Catch.Edit lineVertices[0] = new Vector2(StartX, startY); lineVertices[1] = lineVertices[0] + new Vector2(x, y); - var verticalPath = verticalPaths[i]; verticalPath.Vertices = verticalLineVertices[i]; verticalPath.OriginPosition = verticalPath.PositionInBoundingBox(Vector2.Zero); }