1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-03 19:24:24 +08:00

Fix clicking area of news sidebar post links

Side effect is that the hover color is yellow and pressing it opens an external dialog, but those are temporary (pending implementation of link underline to make `Light1` hover more readable and set at a higher level and news pages).
This commit is contained in:
Joseph Madamba
2023-05-20 16:29:49 -07:00
Unverified
parent 7fa8a1148d
commit ec5f0bbf42
+4 -25
View File
@@ -20,7 +20,7 @@ using System.Diagnostics;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Platform;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.News.Sidebar
{
@@ -123,35 +123,14 @@ namespace osu.Game.Overlays.News.Sidebar
}
}
private partial class PostButton : OsuHoverContainer
private partial class PostButton : LinkFlowContainer
{
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
private readonly TextFlowContainer text;
private readonly APINewsPost post;
public PostButton(APINewsPost post)
: base(t => t.Font = OsuFont.GetFont(size: 12))
{
this.post = post;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Child = text = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12))
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Text = post.Title
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider overlayColours, GameHost host)
{
IdleColour = overlayColours.Light2;
HoverColour = overlayColours.Light1;
TooltipText = "view in browser";
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
AddLink(post.Title, LinkAction.External, "https://osu.ppy.sh/home/news/" + post.Slug, "view in browser");
}
}