diff --git a/module.json b/module.json index ae364dd..524a38d 100644 --- a/module.json +++ b/module.json @@ -1,7 +1,7 @@ { "id": "dh-feartrackerplus", "title": "Daggerheart Fear Tracker Plus", - "version": "2.0.1", + "version": "2.0.2", "compatibility": { "minimum": "13", "verified": "13" @@ -30,8 +30,8 @@ "styles": [ "styles/module.css" ], - "url": "https://github.com/cptn-cosmo/dh-feartrackerplus", - "manifest": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/latest/download/module.json", - "download": "https://github.com/cptn-cosmo/dh-feartrackerplus/releases/download/2.0.1/dh-feartrackerplus.zip", + "url": "https://git.geeks.gay/cosmo/dh-feartrackerplus", + "manifest": "https://git.geeks.gay/cosmo/dh-feartrackerplus/raw/branch/main/module.json", + "download": "https://git.geeks.gay/cosmo/dh-feartrackerplus/releases/download/2.0.2/dh-feartrackerplus.zip", "description": "Customizes the Fear Tracker for Daggerheart." } \ No newline at end of file diff --git a/scripts/.module.js.kate-swp b/scripts/.module.js.kate-swp deleted file mode 100644 index 8cc68b2..0000000 Binary files a/scripts/.module.js.kate-swp and /dev/null differ diff --git a/scripts/fear-tracker-app.js b/scripts/fear-tracker-app.js index 5e6d94f..9ac9fac 100644 --- a/scripts/fear-tracker-app.js +++ b/scripts/fear-tracker-app.js @@ -50,6 +50,21 @@ export class FearTrackerApp extends HandlebarsApplicationMixin(ApplicationV2) { this.instance.render({ force: true, position: pos }); } + // Removed render override to prevent destroying the context menu on re-render + // Since this.element persists, we don't need to recreate the listener. + + async close(options) { + if (this._contextMenu) { + try { + await this._contextMenu.close({ animate: false }); + } catch (e) { + // Ignore + } + this._contextMenu = null; + } + return super.close(options); + } + _onRender(context, options) { super._onRender(context, options); @@ -109,8 +124,12 @@ export class FearTrackerApp extends HandlebarsApplicationMixin(ApplicationV2) { this.#animateMaxFear(); // Context Menu for Unlocking (Right-click) + // Check if we already have a context menu instance. + // We only need one per application instance as long as this.element persists. + if (this._contextMenu) return; + // Use namespaced class and provide empty options to avoid system error - new foundry.applications.ux.ContextMenu(this.element, ".fear-tracker-window", [ + this._contextMenu = new foundry.applications.ux.ContextMenu(this.element, ".fear-tracker-window", [ { name: "Unlock Position", icon: '', @@ -129,7 +148,7 @@ export class FearTrackerApp extends HandlebarsApplicationMixin(ApplicationV2) { this.render(); } } - ], {}); + ], { jQuery: false }); } updateFearData(data) { diff --git a/scripts/module.js b/scripts/module.js index 907322e..b98250d 100644 --- a/scripts/module.js +++ b/scripts/module.js @@ -149,7 +149,7 @@ Hooks.once('init', () => { game.settings.register(MODULE_ID, 'showFearNumber', { name: 'Show Fear Number', - hint: 'Display the numerical value (e.g., 3 / 6) at the bottom.', + hint: 'Display the numerical value (e.g., 4 / 12) at the bottom.', scope: 'client', config: true, type: Boolean,