Ensure AttributeManager is a singleton per actor
This commit is contained in:
parent
cd3f076b7d
commit
df9a63073a
1 changed files with 14 additions and 2 deletions
|
|
@ -54,6 +54,12 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
|
|
||||||
return controls;
|
return controls;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async close() {
|
||||||
|
this.attributeManager?.close();
|
||||||
|
this.attributeManager = null;
|
||||||
|
return super.close();
|
||||||
|
};
|
||||||
// #endregion Lifecycle
|
// #endregion Lifecycle
|
||||||
|
|
||||||
// #region Data Prep
|
// #region Data Prep
|
||||||
|
|
@ -103,10 +109,16 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
||||||
// #endregion Data Prep
|
// #endregion Data Prep
|
||||||
|
|
||||||
// #region Actions
|
// #region Actions
|
||||||
|
attributeManager = null;
|
||||||
|
|
||||||
/** @this {PlayerSheet} */
|
/** @this {PlayerSheet} */
|
||||||
static async #manageAttributes() {
|
static async #manageAttributes() {
|
||||||
const app = new AttributeManager({ document: this.actor });
|
this.attributeManager ??= new AttributeManager({ document: this.actor });
|
||||||
await app.render({ force: true });
|
if (this.attributeManager.rendered) {
|
||||||
|
await this.attributeManager.bringToFront();
|
||||||
|
} else {
|
||||||
|
await this.attributeManager.render({ force: true });
|
||||||
|
}
|
||||||
};
|
};
|
||||||
// #endregion Actions
|
// #endregion Actions
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue