From a10d626c21a102431b874f2e86fa74e3a661172f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20R=C3=A4tzel?= Date: Sun, 11 Dec 2016 11:34:11 +0100 Subject: [PATCH] Fix Bug: Label containing the keyboard shortcut was chosen. --- src/Sanderling.ABot/Bot/BotExtension.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Sanderling.ABot/Bot/BotExtension.cs b/src/Sanderling.ABot/Bot/BotExtension.cs index 84f6a6d..5212df1 100644 --- a/src/Sanderling.ABot/Bot/BotExtension.cs +++ b/src/Sanderling.ABot/Bot/BotExtension.cs @@ -43,8 +43,18 @@ static public int AttackPriorityIndexForOverviewEntryEWar(IEnumerable 1 == subsequenceTaskPath?.Count(BotExtension.LastHasMotion)) ?.LastOrDefault(); - static public IUIElementText TitleElementText(this IModuleButtonTooltip tooltip) => - tooltip?.LabelText?.OrderByCenterVerticalDown()?.FirstOrDefault(); + static public IUIElementText TitleElementText(this IModuleButtonTooltip tooltip) + { + var tooltipHorizontalCenter = tooltip?.RegionCenter()?.A; + + var setLabelIntersectingHorizontalCenter = + tooltip?.LabelText + ?.Where(label => label?.Region.Min0 < tooltipHorizontalCenter && tooltipHorizontalCenter < label?.Region.Max0); + + return + setLabelIntersectingHorizontalCenter + ?.OrderByCenterVerticalDown()?.FirstOrDefault(); + } static public bool ShouldBeActivePermanent(this Accumulation.IShipUiModule module, Bot bot) => new[]