mirror of
https://github.com/ppy/osu.git
synced 2024-12-21 14:52:55 +08:00
47 lines
1.3 KiB
C#
47 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 Markdig.Syntax;
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers.Markdown;
|
|
using osu.Framework.Graphics.Shapes;
|
|
using osu.Game.Overlays;
|
|
|
|
namespace osu.Game.Graphics.Containers.Markdown
|
|
{
|
|
public class OsuMarkdownQuoteBlock : MarkdownQuoteBlock
|
|
{
|
|
public OsuMarkdownQuoteBlock(QuoteBlock quoteBlock)
|
|
: base(quoteBlock)
|
|
{
|
|
}
|
|
|
|
protected override Drawable CreateBackground() => new QuoteBackground();
|
|
|
|
public override MarkdownTextFlowContainer CreateTextFlow()
|
|
{
|
|
return base.CreateTextFlow().With(f => f.Margin = new MarginPadding
|
|
{
|
|
Vertical = 10,
|
|
Horizontal = 20,
|
|
});
|
|
}
|
|
|
|
private class QuoteBackground : Box
|
|
{
|
|
[BackgroundDependencyLoader]
|
|
private void load(OverlayColourProvider colourProvider)
|
|
{
|
|
Anchor = Anchor.CentreLeft;
|
|
Origin = Anchor.CentreLeft;
|
|
RelativeSizeAxes = Axes.Y;
|
|
Width = 2;
|
|
Colour = colourProvider.Content2;
|
|
}
|
|
}
|
|
}
|
|
}
|