From 7f96ee4589254409c145f3e5a2e27a1778b64eaf Mon Sep 17 00:00:00 2001 From: teees Date: Wed, 21 Oct 2015 10:38:49 +0200 Subject: [PATCH 1/2] Multi line simple tooltips --- OpenRA.Mods.Common/Widgets/Logic/SimpleTooltipLogic.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/SimpleTooltipLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SimpleTooltipLogic.cs index ededbfa962..de350cb159 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/SimpleTooltipLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/SimpleTooltipLogic.cs @@ -26,11 +26,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic tooltipContainer.BeforeRender = () => { labelText = getText(); - var textWidth = font.Measure(labelText).X; - if (textWidth != cachedWidth) + var textDim = font.Measure(labelText); + if (textDim.X != cachedWidth) { - label.Bounds.Width = textWidth; - widget.Bounds.Width = 2 * label.Bounds.X + textWidth; + label.Bounds.Width = textDim.X; + widget.Bounds.Width = 2 * label.Bounds.X + textDim.X; + label.Bounds.Height = textDim.Y; + widget.Bounds.Height = 4 * label.Bounds.Y + textDim.Y; } }; From f9c34468493454e3653b05a3237d5ea7e22ef060 Mon Sep 17 00:00:00 2001 From: teees Date: Wed, 21 Oct 2015 10:39:31 +0200 Subject: [PATCH 2/2] Added owner name and faction to map editor tooltips --- OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs index 1a616a8159..9255bb1e27 100644 --- a/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs +++ b/OpenRA.Mods.Common/Traits/World/EditorActorPreview.cs @@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits } var tooltip = Info.TraitInfoOrDefault(); - Tooltip = tooltip == null ? ID + ": " + Info.Name : ID + ": " + tooltip.Name + " (" + Info.Name + ")"; + Tooltip = tooltip == null ? ID + ": " + Info.Name : ID + ": " + tooltip.Name + " (" + Info.Name + ")" + "\n" + owner.Name + " (" + owner.Faction + ")"; GeneratePreviews();