From 51aa17eb524e70899f09c1058842e0d55f58109b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Apr 2022 22:17:01 +0900 Subject: [PATCH] Fix context menus not working --- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 18 +++++++++++++++++- osu.Game/Graphics/UserInterface/OsuMenu.cs | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index b1d4691938..20fa7d5148 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -130,7 +131,22 @@ namespace osu.Game.Graphics.UserInterface BackgroundColourSelected = SelectionColour }; - protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); + protected override ScrollContainer CreateScrollContainer(Direction direction) => new DropdownScrollContainer(direction); + + // Hotfix for https://github.com/ppy/osu/issues/17961 + public class DropdownScrollContainer : OsuScrollContainer + { + public DropdownScrollContainer(Direction direction) + : base(direction) + { + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + base.OnMouseDown(e); + return true; + } + } #region DrawableOsuDropdownMenuItem diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index a16adcbd57..bfdfd32fb3 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; +using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osuTK; @@ -81,7 +82,22 @@ namespace osu.Game.Graphics.UserInterface return new DrawableOsuMenuItem(item); } - protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuScrollContainer(direction); + protected override ScrollContainer CreateScrollContainer(Direction direction) => new OsuMenuScrollContainer(direction); + + // Hotfix for https://github.com/ppy/osu/issues/17961 + public class OsuMenuScrollContainer : OsuScrollContainer + { + public OsuMenuScrollContainer(Direction direction) + : base(direction) + { + } + + protected override bool OnMouseDown(MouseDownEvent e) + { + base.OnMouseDown(e); + return true; + } + } protected override Menu CreateSubMenu() => new OsuMenu(Direction.Vertical) {