From 10dc1314f610842e9fb51dc1d00ba3c770b4e734 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 22 Jan 2026 01:06:40 +0900 Subject: [PATCH] Fix carousel items becoming incorrectly selected due to bindable leakage (#36414) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As discussed in discord. Fixed from multiple angles. --------- Co-authored-by: Bartłomiej Dach --- osu.Game/Graphics/Carousel/Carousel.cs | 7 ++++++- .../Screens/SelectV2/PanelBeatmapSet.SpreadDisplay.cs | 3 ++- osu.Game/Screens/SelectV2/PanelBeatmapSet.cs | 3 ++- .../SelectV2/PanelBeatmapStandalone.SpreadDisplay.cs | 8 ++++++-- osu.Game/Screens/SelectV2/PanelBeatmapStandalone.cs | 7 +++++-- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/Carousel/Carousel.cs b/osu.Game/Graphics/Carousel/Carousel.cs index be1c013478..3b7e31b2ea 100644 --- a/osu.Game/Graphics/Carousel/Carousel.cs +++ b/osu.Game/Graphics/Carousel/Carousel.cs @@ -561,7 +561,12 @@ namespace osu.Game.Graphics.Carousel } } - private enum TraversalType { Keyboard, Set, Group } + private enum TraversalType + { + Keyboard, + Set, + Group + } private record TraversalOperation(TraversalType Type, int Direction); diff --git a/osu.Game/Screens/SelectV2/PanelBeatmapSet.SpreadDisplay.cs b/osu.Game/Screens/SelectV2/PanelBeatmapSet.SpreadDisplay.cs index 4cbe4521bb..db34630c48 100644 --- a/osu.Game/Screens/SelectV2/PanelBeatmapSet.SpreadDisplay.cs +++ b/osu.Game/Screens/SelectV2/PanelBeatmapSet.SpreadDisplay.cs @@ -27,7 +27,8 @@ namespace osu.Game.Screens.SelectV2 public partial class SpreadDisplay : OsuAnimatedButton { public Bindable BeatmapSet { get; } = new Bindable(); - public Bindable?> VisibleBeatmaps { get; } = new Bindable?>(); + + public IBindable?> VisibleBeatmaps { get; } = new Bindable?>(); public BindableBool Expanded { get; } = new BindableBool(); diff --git a/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs b/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs index fb31d7a790..f6a33e5ce0 100644 --- a/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs +++ b/osu.Game/Screens/SelectV2/PanelBeatmapSet.cs @@ -157,7 +157,6 @@ namespace osu.Game.Screens.SelectV2 { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Expanded = { BindTarget = Expanded }, VisibleBeatmaps = { BindTarget = VisibleBeatmaps }, }, }, @@ -189,6 +188,8 @@ namespace osu.Game.Screens.SelectV2 chevronIcon.ResizeWidthTo(0f, DURATION, Easing.OutQuint); chevronIcon.FadeTo(0f, DURATION, Easing.OutQuint); } + + spreadDisplay.Expanded.Value = Expanded.Value; } protected override void PrepareForUse() diff --git a/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.SpreadDisplay.cs b/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.SpreadDisplay.cs index b3fa2fa01e..b6b0bac077 100644 --- a/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.SpreadDisplay.cs +++ b/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.SpreadDisplay.cs @@ -52,6 +52,12 @@ namespace osu.Game.Screens.SelectV2 AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; Content.CornerRadius = 5; + + Action = () => + { + if (Beatmap.Value != null) + scopedBeatmapSet.Value = Beatmap.Value.BeatmapSet!; + }; } [BackgroundDependencyLoader] @@ -214,8 +220,6 @@ namespace osu.Game.Screens.SelectV2 dot.Alpha = (1 + 4 * (float)(succeeding.Count - i) / succeeding.Count) / 5; } } - - Action = () => scopedBeatmapSet.Value = Beatmap.Value.BeatmapSet!; } protected override bool OnMouseDown(MouseDownEvent e) diff --git a/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.cs b/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.cs index 5071fe4aaa..5fc6be3d62 100644 --- a/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.cs +++ b/osu.Game/Screens/SelectV2/PanelBeatmapStandalone.cs @@ -193,7 +193,6 @@ namespace osu.Game.Screens.SelectV2 { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Enabled = { BindTarget = Selected } } }, } @@ -211,7 +210,11 @@ namespace osu.Game.Screens.SelectV2 ruleset.BindValueChanged(_ => updateKeyCount()); mods.BindValueChanged(_ => updateKeyCount(), true); - Selected.BindValueChanged(s => Expanded.Value = s.NewValue, true); + Selected.BindValueChanged(s => + { + Expanded.Value = s.NewValue; + spreadDisplay.Enabled.Value = s.NewValue; + }, true); } protected override void PrepareForUse()