fix: unset focus target when missing actor hovered
This commit is contained in:
parent
a057adfed5
commit
ab762d2b45
@ -370,7 +370,6 @@ namespace PeepingTom {
|
|||||||
private void AddEntry(Targeter targeter, Actor actor, ref bool anyHovered, ImGuiSelectableFlags flags = ImGuiSelectableFlags.None) {
|
private void AddEntry(Targeter targeter, Actor actor, ref bool anyHovered, ImGuiSelectableFlags flags = ImGuiSelectableFlags.None) {
|
||||||
ImGui.Selectable(targeter.Name, false, flags);
|
ImGui.Selectable(targeter.Name, false, flags);
|
||||||
bool hover = ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled);
|
bool hover = ImGui.IsItemHovered(ImGuiHoveredFlags.AllowWhenDisabled);
|
||||||
anyHovered |= hover;
|
|
||||||
bool left = hover && ImGui.IsMouseClicked(0);
|
bool left = hover && ImGui.IsMouseClicked(0);
|
||||||
bool right = hover && ImGui.IsMouseClicked(1);
|
bool right = hover && ImGui.IsMouseClicked(1);
|
||||||
if (actor == null) {
|
if (actor == null) {
|
||||||
@ -379,6 +378,11 @@ namespace PeepingTom {
|
|||||||
.FirstOrDefault();
|
.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.config.FocusTargetOnHover && hover && actor != null) {
|
||||||
if (!this.previousFocus.Present) {
|
if (!this.previousFocus.Present) {
|
||||||
this.previousFocus = new Optional<Actor>(this.pi.ClientState.Targets.FocusTarget);
|
this.previousFocus = new Optional<Actor>(this.pi.ClientState.Targets.FocusTarget);
|
||||||
|
Loading…
Reference in New Issue
Block a user