mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Remember the position and size of the compendium browser
This commit is contained in:
parent
c6741b1c7a
commit
4f6ddba087
2 changed files with 18 additions and 5 deletions
|
|
@ -84,12 +84,16 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
/** @inheritDoc */
|
||||
async _preRender(context, options) {
|
||||
this.presets = options.presets ?? {};
|
||||
const userPresetPosition = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`compendiumBrowser`].position);
|
||||
options.position = userPresetPosition ?? ItemBrowser.DEFAULT_OPTIONS.position;
|
||||
|
||||
const width = this.presets?.render?.noFolder === true || this.presets?.render?.lite === true ? 600 : 850;
|
||||
if(this.rendered)
|
||||
this.setPosition({ width });
|
||||
else
|
||||
options.position.width = width;
|
||||
if (!userPresetPosition) {
|
||||
const width = this.presets?.render?.noFolder === true || this.presets?.render?.lite === true ? 600 : 850;
|
||||
if(this.rendered)
|
||||
this.setPosition({ width });
|
||||
else
|
||||
options.position.width = width;
|
||||
}
|
||||
|
||||
await super._preRender(context, options);
|
||||
}
|
||||
|
|
@ -112,6 +116,11 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
});
|
||||
}
|
||||
|
||||
_onPosition(position) {
|
||||
game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`compendiumBrowser`].position, position);
|
||||
}
|
||||
|
||||
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ export const encounterCountdown = {
|
|||
position: 'countdown-encounter-position'
|
||||
};
|
||||
|
||||
export const compendiumBrowser = {
|
||||
position: 'compendium-browser-position'
|
||||
};
|
||||
|
||||
export const itemAttachmentSource = 'attachmentSource';
|
||||
|
||||
export const userFlags = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue