fix: Improve context menu lifecycle management, update module version, and migrate repository links.
This commit is contained in:
parent
b1042f81eb
commit
f41aa5cc31
4 changed files with 26 additions and 7 deletions
|
|
@ -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."
|
||||
}
|
||||
Binary file not shown.
|
|
@ -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: '<i class="fas fa-lock-open"></i>',
|
||||
|
|
@ -129,7 +148,7 @@ export class FearTrackerApp extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this.render();
|
||||
}
|
||||
}
|
||||
], {});
|
||||
], { jQuery: false });
|
||||
}
|
||||
|
||||
updateFearData(data) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue