From af55d40a5aa02f3d670b7d7c90ebc9a265ec8b26 Mon Sep 17 00:00:00 2001 From: Idle <651462+reonZ@users.noreply.github.com> Date: Thu, 29 Aug 2024 12:32:30 +0200 Subject: [PATCH] fix token hud not closing when disabled --- src/hud/token.ts | 4 ++++ src/hud/tooltip.ts | 4 ++++ src/hud/tracker.ts | 7 +++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/hud/token.ts b/src/hud/token.ts index 9036338..8e53671 100644 --- a/src/hud/token.ts +++ b/src/hud/token.ts @@ -176,6 +176,10 @@ class PF2eHudToken extends makeAdvancedHUD( this.#canvasTearDownHook.toggle(enabled); this.#renderTokenHudHook.toggle(enabled); this.#renderActorSheetHook.toggle(enabled); + + if (!enabled && this.rendered) { + this.close(); + } } _onSetToken(token: TokenPF2e | null): void { diff --git a/src/hud/tooltip.ts b/src/hud/tooltip.ts index 3686e02..789be5a 100644 --- a/src/hud/tooltip.ts +++ b/src/hud/tooltip.ts @@ -248,6 +248,10 @@ class PF2eHudTooltip extends PF2eHudBaseToken 0; this.#tokenRefreshWrapper.toggle(enableDraw); this.#canvasTearDownHook.toggle(enableDraw); + + if (!enabled && this.rendered) { + this.close(); + } } _tokenCleanup() { diff --git a/src/hud/tracker.ts b/src/hud/tracker.ts index 4e27073..fb6d7a0 100644 --- a/src/hud/tracker.ts +++ b/src/hud/tracker.ts @@ -135,8 +135,11 @@ class PF2eHudTracker extends PF2eHudBase