2021-04-28 11:11:29 +08: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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-04-28 11:11:29 +08:00
|
|
|
using Markdig.Syntax;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers.Markdown;
|
2021-05-06 18:13:46 +08:00
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-04-28 11:11:29 +08:00
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Containers.Markdown
|
|
|
|
{
|
|
|
|
public class OsuMarkdownQuoteBlock : MarkdownQuoteBlock
|
|
|
|
{
|
|
|
|
public OsuMarkdownQuoteBlock(QuoteBlock quoteBlock)
|
|
|
|
: base(quoteBlock)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-05-06 18:13:46 +08:00
|
|
|
protected override Drawable CreateBackground() => new QuoteBackground();
|
2021-04-28 11:11:29 +08:00
|
|
|
|
|
|
|
public override MarkdownTextFlowContainer CreateTextFlow()
|
|
|
|
{
|
2021-05-06 16:11:45 +08:00
|
|
|
return base.CreateTextFlow().With(f => f.Margin = new MarginPadding
|
2021-04-28 11:11:29 +08:00
|
|
|
{
|
2021-05-06 06:36:46 +08:00
|
|
|
Vertical = 10,
|
|
|
|
Horizontal = 20,
|
2021-05-06 16:11:45 +08:00
|
|
|
});
|
2021-04-28 11:11:29 +08:00
|
|
|
}
|
2021-05-06 18:13:46 +08:00
|
|
|
|
|
|
|
private class QuoteBackground : Box
|
|
|
|
{
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
{
|
|
|
|
Anchor = Anchor.CentreLeft;
|
|
|
|
Origin = Anchor.CentreLeft;
|
|
|
|
RelativeSizeAxes = Axes.Y;
|
|
|
|
Width = 2;
|
|
|
|
Colour = colourProvider.Content2;
|
|
|
|
}
|
|
|
|
}
|
2021-04-28 11:11:29 +08:00
|
|
|
}
|
|
|
|
}
|