Allow horizontal scroll on results screen when not hovering expanded panel

This commit is contained in:
Dean Herbert 2020-05-31 13:50:42 +09:00
parent 465df1731c
commit f2dadeeeb5
1 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
@ -107,6 +108,9 @@ private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
// Find the panel corresponding to the new score.
expandedPanel = flow.SingleOrDefault(p => p.Score == score.NewValue);
// handle horizontal scroll only when not hovering the expanded panel.
scroll.HandleScroll = () => expandedPanel?.IsHovered != true;
if (expandedPanel == null)
return;
@ -166,6 +170,11 @@ public Scroll()
/// </summary>
public float? InstantScrollTarget;
/// <summary>
/// Whether this container should handle scroll trigger events.
/// </summary>
public Func<bool> HandleScroll;
protected override void UpdateAfterChildren()
{
if (InstantScrollTarget != null)
@ -177,9 +186,9 @@ protected override void UpdateAfterChildren()
base.UpdateAfterChildren();
}
public override bool HandlePositionalInput => false;
public override bool HandlePositionalInput => HandleScroll();
public override bool HandleNonPositionalInput => false;
public override bool HandleNonPositionalInput => HandleScroll();
}
}
}