Add tooltip to overflowing map title in server browser
This commit is contained in:
committed by
Paul Chote
parent
70892a6661
commit
31056d4253
@@ -231,12 +231,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (mapPreview != null)
|
if (mapPreview != null)
|
||||||
mapPreview.Preview = () => currentMap;
|
mapPreview.Preview = () => currentMap;
|
||||||
|
|
||||||
var mapTitle = widget.GetOrNull<LabelWidget>("SELECTED_MAP");
|
var mapTitle = widget.GetOrNull<LabelWithTooltipWidget>("SELECTED_MAP");
|
||||||
if (mapTitle != null)
|
if (mapTitle != null)
|
||||||
{
|
{
|
||||||
var font = Game.Renderer.Fonts[mapTitle.Font];
|
var font = Game.Renderer.Fonts[mapTitle.Font];
|
||||||
var title = new CachedTransform<MapPreview, string>(m =>
|
var title = new CachedTransform<MapPreview, string>(m =>
|
||||||
WidgetUtils.TruncateText(m.Title, mapTitle.Bounds.Width, font));
|
{
|
||||||
|
var truncated = WidgetUtils.TruncateText(m.Title, mapTitle.Bounds.Width, font);
|
||||||
|
|
||||||
|
if (m.Title != truncated)
|
||||||
|
mapTitle.GetTooltipText = () => m.Title;
|
||||||
|
else
|
||||||
|
mapTitle.GetTooltipText = null;
|
||||||
|
|
||||||
|
return truncated;
|
||||||
|
});
|
||||||
|
|
||||||
mapTitle.GetText = () =>
|
mapTitle.GetText = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -168,12 +168,14 @@ Container@LOBBY_SERVERS_BIN:
|
|||||||
Width: PARENT_RIGHT - 2
|
Width: PARENT_RIGHT - 2
|
||||||
Height: PARENT_BOTTOM - 2
|
Height: PARENT_BOTTOM - 2
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Label@SELECTED_MAP:
|
LabelWithTooltip@SELECTED_MAP:
|
||||||
Y: 172
|
Y: 172
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@SELECTED_IP:
|
Label@SELECTED_IP:
|
||||||
Y: 187
|
Y: 187
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
@@ -168,12 +168,14 @@ Container@MULTIPLAYER_PANEL:
|
|||||||
Width: PARENT_RIGHT - 2
|
Width: PARENT_RIGHT - 2
|
||||||
Height: PARENT_BOTTOM - 2
|
Height: PARENT_BOTTOM - 2
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Label@SELECTED_MAP:
|
LabelWithTooltip@SELECTED_MAP:
|
||||||
Y: 173
|
Y: 173
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@SELECTED_IP:
|
Label@SELECTED_IP:
|
||||||
Y: 188
|
Y: 188
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
@@ -164,12 +164,14 @@ Container@LOBBY_SERVERS_BIN:
|
|||||||
Width: PARENT_RIGHT - 2
|
Width: PARENT_RIGHT - 2
|
||||||
Height: PARENT_BOTTOM - 2
|
Height: PARENT_BOTTOM - 2
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Label@SELECTED_MAP:
|
LabelWithTooltip@SELECTED_MAP:
|
||||||
Y: 173
|
Y: 173
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@SELECTED_IP:
|
Label@SELECTED_IP:
|
||||||
Y: 188
|
Y: 188
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
@@ -160,12 +160,14 @@ Background@MULTIPLAYER_PANEL:
|
|||||||
Width: PARENT_RIGHT - 2
|
Width: PARENT_RIGHT - 2
|
||||||
Height: PARENT_BOTTOM - 2
|
Height: PARENT_BOTTOM - 2
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Label@SELECTED_MAP:
|
LabelWithTooltip@SELECTED_MAP:
|
||||||
Y: 173
|
Y: 173
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Center
|
Align: Center
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
TooltipTemplate: SIMPLE_TOOLTIP
|
||||||
Label@SELECTED_IP:
|
Label@SELECTED_IP:
|
||||||
Y: 188
|
Y: 188
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
Reference in New Issue
Block a user