2022-01-03 04:18:27 +00:00
|
|
|
// 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 osu.Framework.Input.Events;
|
|
|
|
using osu.Framework.Utils;
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
|
|
|
namespace osu.Game.Beatmaps.Drawables.Cards
|
|
|
|
{
|
|
|
|
public class ExpandedContentScrollContainer : OsuScrollContainer
|
|
|
|
{
|
2022-01-04 04:22:00 +00:00
|
|
|
public const float HEIGHT = 200;
|
2022-01-03 04:18:27 +00:00
|
|
|
|
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
Height = Math.Min(Content.DrawHeight, HEIGHT);
|
2022-01-19 21:21:05 +00:00
|
|
|
ScrollbarVisible = allowScroll;
|
2022-01-03 04:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private bool allowScroll => !Precision.AlmostEquals(DrawSize, Content.DrawSize);
|
|
|
|
|
|
|
|
protected override bool OnDragStart(DragStartEvent e)
|
|
|
|
{
|
|
|
|
if (!allowScroll)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return base.OnDragStart(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnDrag(DragEvent e)
|
|
|
|
{
|
|
|
|
if (!allowScroll)
|
|
|
|
return;
|
|
|
|
|
|
|
|
base.OnDrag(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnDragEnd(DragEndEvent e)
|
|
|
|
{
|
|
|
|
if (!allowScroll)
|
|
|
|
return;
|
|
|
|
|
|
|
|
base.OnDragEnd(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override bool OnScroll(ScrollEvent e)
|
|
|
|
{
|
|
|
|
if (!allowScroll)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return base.OnScroll(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|