mirror of
https://github.com/ppy/osu.git
synced 2026-05-16 20:43:12 +08:00
3954d8f3be
`CommentReportButton` is pretty cursed but I guess I can see why it is like it is. Short of inlining it into `DrawableComment` this is probably the best escape hatch (which I wouldn't be against doing, by the way, just not sure it's the most productive use of time unless review feedback comes in saying that would be a better path forward).
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
// 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.
|
|
|
|
#nullable disable
|
|
|
|
using System;
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.Sprites;
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
namespace osu.Game.Graphics.Containers
|
|
{
|
|
public partial class OsuTextFlowContainer : TextFlowContainer
|
|
{
|
|
public OsuTextFlowContainer(Action<SpriteText> defaultCreationParameters = null)
|
|
: base(defaultCreationParameters)
|
|
{
|
|
}
|
|
|
|
protected override SpriteText CreateSpriteText() => new OsuSpriteText();
|
|
|
|
public ITextPart AddArbitraryDrawable(Drawable drawable) => AddPart(new TextPartManual(new ArbitraryDrawableWrapper { Child = drawable }.Yield()));
|
|
|
|
public ITextPart AddIcon(IconUsage icon, Action<SpriteText> creationParameters = null) => AddText(icon.Icon.ToString(), creationParameters);
|
|
|
|
private partial class ArbitraryDrawableWrapper : Container, IHasLineBaseHeight
|
|
{
|
|
public float LineBaseHeight => (Child as IHasLineBaseHeight)?.LineBaseHeight ?? DrawHeight;
|
|
|
|
public ArbitraryDrawableWrapper()
|
|
{
|
|
AutoSizeAxes = Axes.Both;
|
|
}
|
|
}
|
|
}
|
|
}
|