fix: unset focus target when missing actor hovered

This commit is contained in:
Anna 2020-08-06 13:20:37 -04:00
parent ef155e54d5
commit 7fa7204179
1 changed files with 5 additions and 1 deletions

View File

@ -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<Actor>(this.pi.ClientState.Targets.FocusTarget);