Update the size settings to apply without using the constructor

This commit is contained in:
Eldritch-Oliver 2025-09-17 19:12:23 -06:00
parent dff8a46ebb
commit c29fa3e017

View file

@ -40,29 +40,28 @@ export class PlayerSheet extends HandlebarsApplicationMixin(ActorSheetV2) {
// #endregion Options
// #region Lifecycle
constructor(options) {
if (options.document) {
const sizing = getProperty(options.document, `flags.${__ID__}.PlayerSheet.size`) ?? {};
_initializeApplicationOptions(options) {
const sizing = getProperty(options.document, `flags.${__ID__}.PlayerSheet.size`) ?? {};
options.window ??= {};
switch (sizing.resizable) {
case `false`:
options.window.resizable ??= false;
break;
case `true`:
options.window.resizable ??= true;
break;
};
options.position ??= {};
if (sizing.width) {
options.position.width ??= sizing.width;
}
if (sizing.height) {
options.position.height ??= sizing.height;
}
options.window ??= {};
switch (sizing.resizable) {
case `false`:
options.window.resizable ??= false;
break;
case `true`:
options.window.resizable ??= true;
break;
};
super(options);
options.position ??= {};
if (sizing.width) {
options.position.width ??= sizing.width;
};
if (sizing.height) {
options.position.height ??= sizing.height;
};
return super._initializeApplicationOptions(options);
};
_getHeaderControls() {