From ab762d2b4542551107d842361674cf758aca964b Mon Sep 17 00:00:00 2001 From: Anna Clemens Date: Thu, 6 Aug 2020 13:20:37 -0400 Subject: [PATCH] fix: unset focus target when missing actor hovered --- Peeping Tom/PluginUI.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Peeping Tom/PluginUI.cs b/Peeping Tom/PluginUI.cs index e727b92..9f5445f 100644 --- a/Peeping Tom/PluginUI.cs +++ b/Peeping Tom/PluginUI.cs @@ -370,7 +370,6 @@ namespace PeepingTom { private void AddEntry(Targeter targeter, Actor actor, ref bool anyHovered, ImGuiSelectableFlags flags = ImGuiSelectableFlags.None) { ImGui.Selectable(targeter.Name, false, flags); bool hover = ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled); - anyHovered |= hover; bool left = hover && ImGui.IsMouseClicked(0); bool right = hover && ImGui.IsMouseClicked(1); if (actor == null) { @@ -379,6 +378,11 @@ namespace PeepingTom { .FirstOrDefault(); } + // don't count as hovered if the actor isn't here (clears focus target when hovering missing actors) + if (actor != null) { + anyHovered |= hover; + } + if (this.config.FocusTargetOnHover && hover && actor != null) { if (!this.previousFocus.Present) { this.previousFocus = new Optional(this.pi.ClientState.Targets.FocusTarget);