mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Merge pull request #11759 from peppy/chat-show-url-in-tooltips
Show URLs in tooltips when custom text has replaced the link
This commit is contained in:
commit
267869bd0b
@ -38,7 +38,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
foreach (var link in links)
|
foreach (var link in links)
|
||||||
{
|
{
|
||||||
AddText(text[previousLinkEnd..link.Index]);
|
AddText(text[previousLinkEnd..link.Index]);
|
||||||
AddLink(text.Substring(link.Index, link.Length), link.Action, link.Argument ?? link.Url);
|
|
||||||
|
string displayText = text.Substring(link.Index, link.Length);
|
||||||
|
string linkArgument = link.Argument ?? link.Url;
|
||||||
|
string tooltip = displayText == link.Url ? null : link.Url;
|
||||||
|
|
||||||
|
AddLink(displayText, link.Action, linkArgument, tooltip);
|
||||||
previousLinkEnd = link.Index + link.Length;
|
previousLinkEnd = link.Index + link.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +57,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
=> createLink(AddText(text, creationParameters), new LinkDetails(LinkAction.Custom, null), tooltipText, action);
|
=> createLink(AddText(text, creationParameters), new LinkDetails(LinkAction.Custom, null), tooltipText, action);
|
||||||
|
|
||||||
public void AddLink(string text, LinkAction action, string argument, string tooltipText = null, Action<SpriteText> creationParameters = null)
|
public void AddLink(string text, LinkAction action, string argument, string tooltipText = null, Action<SpriteText> creationParameters = null)
|
||||||
=> createLink(AddText(text, creationParameters), new LinkDetails(action, argument), null);
|
=> createLink(AddText(text, creationParameters), new LinkDetails(action, argument), tooltipText);
|
||||||
|
|
||||||
public void AddLink(IEnumerable<SpriteText> text, LinkAction action = LinkAction.External, string linkArgument = null, string tooltipText = null)
|
public void AddLink(IEnumerable<SpriteText> text, LinkAction action = LinkAction.External, string linkArgument = null, string tooltipText = null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user