From c5d765029ce2383f5d0fe22977acd617a981dcb3 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 26 Oct 2021 11:17:04 +0900 Subject: [PATCH] Don't compute source object for distance snap grid when it is not enabled --- .../Edit/CatchHitObjectComposer.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs index 9c67e4600b..67055fb5e0 100644 --- a/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs +++ b/osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs @@ -152,18 +152,23 @@ namespace osu.Game.Rulesets.Catch.Edit private void updateDistanceSnapGrid() { - var sourceHitObject = getDistanceSnapGridSourceHitObject(); - - if (distanceSnapToggle.Value != TernaryState.True || sourceHitObject == null) + if (distanceSnapToggle.Value != TernaryState.True) { distanceSnapGrid.Hide(); + return; } - else + + var sourceHitObject = getDistanceSnapGridSourceHitObject(); + + if (sourceHitObject == null) { - distanceSnapGrid.Show(); - distanceSnapGrid.StartTime = sourceHitObject.GetEndTime(); - distanceSnapGrid.StartX = sourceHitObject.EffectiveX; + distanceSnapGrid.Hide(); + return; } + + distanceSnapGrid.Show(); + distanceSnapGrid.StartTime = sourceHitObject.GetEndTime(); + distanceSnapGrid.StartX = sourceHitObject.EffectiveX; } } }