Fix expanded content scrollbar inadvertently hiding expanded content

This commit is contained in:
Bartłomiej Dach 2022-01-19 22:30:49 +01:00
parent 77748a5f93
commit 247c557eaf
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Graphics.Containers;
@ -12,6 +13,8 @@ namespace osu.Game.Beatmaps.Drawables.Cards
{
public const float HEIGHT = 200;
protected override ScrollbarContainer CreateScrollbar(Direction direction) => new ExpandedContentScrollbar(direction);
protected override void Update()
{
base.Update();
@ -53,5 +56,22 @@ namespace osu.Game.Beatmaps.Drawables.Cards
return base.OnScroll(e);
}
private class ExpandedContentScrollbar : OsuScrollbar
{
public ExpandedContentScrollbar(Direction scrollDir)
: base(scrollDir)
{
}
protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);
// do not handle hover, as handling hover would make the beatmap card's expanded content not-hovered
// and therefore cause it to hide when trying to drag the scroll bar.
// see: `BeatmapCardContent.dropdownContent` and its `Unhovered` handler.
return false;
}
}
}
}