Override the default configureSheet action in order to open the custom DocumentSheetConfig
This commit is contained in:
parent
6081b8f9e8
commit
4e304f7d22
1 changed files with 14 additions and 11 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { __ID__, filePath } from "../consts.mjs";
|
||||
import { AttributeManager } from "./AttributeManager.mjs";
|
||||
import { attributeSorter } from "../utils/attributeSort.mjs";
|
||||
import { ResizeControlManager } from "./ResizeControlManager.mjs";
|
||||
import { TAFDocumentSheetConfig } from "./TAFDocumentSheetConfig.mjs";
|
||||
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
const { ActorSheetV2 } = foundry.applications.sheets;
|
||||
|
|
@ -28,7 +28,7 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
},
|
||||
actions: {
|
||||
manageAttributes: this.#manageAttributes,
|
||||
sizeSettings: this.#configureSizeSettings,
|
||||
configureSheet: this.#configureSheet,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -156,15 +156,18 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
|
|||
};
|
||||
};
|
||||
|
||||
#sizeSettings = null;
|
||||
/** @this {PlayerSheet} */
|
||||
static async #configureSizeSettings() {
|
||||
this.#sizeSettings ??= new ResizeControlManager({ document: this.actor });
|
||||
if (this.#sizeSettings.rendered) {
|
||||
await this.#sizeSettings.bringToFront();
|
||||
} else {
|
||||
await this.#sizeSettings.render({ force: true });
|
||||
};
|
||||
static async #configureSheet(event) {
|
||||
event.stopPropagation();
|
||||
if ( event.detail > 1 ) { return }
|
||||
|
||||
// const docSheetConfigWidth = TAFDocumentSheetConfig.DEFAULT_OPTIONS.position.width;
|
||||
new TAFDocumentSheetConfig({
|
||||
document: this.document,
|
||||
position: {
|
||||
top: this.position.top + 40,
|
||||
left: this.position.left + ((this.position.width - 60) / 2),
|
||||
},
|
||||
}).render({ force: true });
|
||||
};
|
||||
// #endregion Actions
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue