Refactor some of the generic sheet for listener handling
This commit is contained in:
parent
52ea7959d4
commit
cfa2179817
2 changed files with 45 additions and 21 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { GenericSheet } from "./GenericSheet.mjs";
|
||||
import { GenericActorSheet } from "./GenericSheet.mjs";
|
||||
|
||||
export class PlayerSheet extends GenericSheet {
|
||||
export class PlayerSheet extends GenericActorSheet {
|
||||
static get defaultOptions() {
|
||||
let opts = mergeObject(
|
||||
super.defaultOptions,
|
||||
|
|
@ -23,23 +23,10 @@ export class PlayerSheet extends GenericSheet {
|
|||
Toggles the expanded state for the detail elements in the sheet.
|
||||
*/
|
||||
html.find(`summary`).on(`click`, ($e) => {
|
||||
console.debug(`.dungeon | summary[data-collapse-id="${$e.target.dataset.collapseId}"] click event (open=${$e.target.parentNode.open})`);
|
||||
/*
|
||||
This seeming inversion of logic is due to the fact that this handler
|
||||
gets called before the element is updated to include/reflect the
|
||||
change, so if the parentNode doesn't actually have it, then we're
|
||||
opening it and vice-versa.
|
||||
*/
|
||||
if (!$e.target.parentNode.open) {
|
||||
this._expanded.add($e.target.dataset.collapseId);
|
||||
} else {
|
||||
this._expanded.delete($e.target.dataset.collapseId);
|
||||
};
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
_expanded = new Set();
|
||||
|
||||
#syncValue() {
|
||||
let delta = 0;
|
||||
for (const actor of game.actors) {
|
||||
|
|
@ -60,10 +47,7 @@ export class PlayerSheet extends GenericSheet {
|
|||
canChangeGroup: ctx.settings.playersCanChangeGroup || ctx.isGM,
|
||||
};
|
||||
|
||||
ctx.meta = {
|
||||
idp: this.actor.uuid,
|
||||
expanded: this._expanded,
|
||||
};
|
||||
ctx.meta.idp = this.actor.uuid;
|
||||
|
||||
console.groupCollapsed(`PlayerSheet.getData`);
|
||||
console.log(`ctx`, ctx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue