mirror of
https://github.com/ppy/osu
synced 2025-02-04 04:11:54 +00:00
add CommentMarkdownHeading
This commit is contained in:
parent
f80c46e2a0
commit
6631f0de19
@ -1,6 +1,7 @@
|
||||
// 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 Markdig.Syntax;
|
||||
using Markdig.Syntax.Inlines;
|
||||
using osu.Framework.Graphics.Containers.Markdown;
|
||||
using osu.Game.Graphics.Containers.Markdown;
|
||||
@ -11,10 +12,37 @@ namespace osu.Game.Overlays.Comments
|
||||
{
|
||||
public override MarkdownTextFlowContainer CreateTextFlow() => new CommentMarkdownTextFlowContainer();
|
||||
|
||||
protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock) => new CommentMarkdownHeading(headingBlock);
|
||||
|
||||
private class CommentMarkdownTextFlowContainer : OsuMarkdownTextFlowContainer
|
||||
{
|
||||
// Don't render image in comment for now
|
||||
protected override void AddImage(LinkInline linkInline) { }
|
||||
}
|
||||
|
||||
private class CommentMarkdownHeading : OsuMarkdownHeading
|
||||
{
|
||||
public CommentMarkdownHeading(HeadingBlock headingBlock)
|
||||
: base(headingBlock)
|
||||
{
|
||||
}
|
||||
|
||||
protected override float GetFontSizeByLevel(int level)
|
||||
{
|
||||
var defaultFontSize = base.GetFontSizeByLevel(6);
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case 1:
|
||||
return 1.2f * defaultFontSize;
|
||||
|
||||
case 2:
|
||||
return 1.1f * defaultFontSize;
|
||||
|
||||
default:
|
||||
return defaultFontSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user