2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2021-04-28 11:11:29 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class OsuMarkdownQuoteBlock : MarkdownQuoteBlock
|
2021-04-28 11:11:29 +08:00
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
2022-11-24 13:32:20 +08:00
|
|
|
|
private partial class QuoteBackground : Box
|
2021-05-06 18:13:46 +08:00
|
|
|
|
{
|
|
|
|
|
[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
|
|
|
|
}
|
|
|
|
|
}
|