From 32daf64a31a09cc459461957d0aa709c52f015f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Apr 2022 19:23:35 +0900 Subject: [PATCH] Use newly exposed framework helper function to find closest parent --- osu.Android.props | 2 +- .../Mods/NestedVerticalScrollContainer.cs | 16 +--------------- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/osu.Android.props b/osu.Android.props index 6a3b113fa2..a168d351fc 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs index c62b52ef27..1bf965beeb 100644 --- a/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs +++ b/osu.Game/Overlays/Mods/NestedVerticalScrollContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Mods { base.LoadComplete(); - parentScrollContainer = findClosestParent(); + parentScrollContainer = this.FindClosestParent(); } protected override bool OnScroll(ScrollEvent e) @@ -43,19 +43,5 @@ namespace osu.Game.Overlays.Mods return base.OnScroll(e); } - - // TODO: remove when https://github.com/ppy/osu-framework/pull/5092 is available. - private T? findClosestParent() where T : class, IDrawable - { - Drawable cursor = this; - - while ((cursor = cursor.Parent) != null) - { - if (cursor is T match) - return match; - } - - return default; - } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 3c01f29671..e968c6602d 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -36,7 +36,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/osu.iOS.props b/osu.iOS.props index c8f170497d..e441ed81ab 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -61,7 +61,7 @@ - + @@ -84,7 +84,7 @@ - +