mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 12:41: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 */
|
/** @inheritDoc */
|
||||||
async _preRender(context, options) {
|
async _preRender(context, options) {
|
||||||
this.presets = options.presets ?? {};
|
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 (!userPresetPosition) {
|
||||||
if(this.rendered)
|
const width = this.presets?.render?.noFolder === true || this.presets?.render?.lite === true ? 600 : 850;
|
||||||
this.setPosition({ width });
|
if(this.rendered)
|
||||||
else
|
this.setPosition({ width });
|
||||||
options.position.width = width;
|
else
|
||||||
|
options.position.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
await super._preRender(context, options);
|
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) {
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@ export const encounterCountdown = {
|
||||||
position: 'countdown-encounter-position'
|
position: 'countdown-encounter-position'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const compendiumBrowser = {
|
||||||
|
position: 'compendium-browser-position'
|
||||||
|
};
|
||||||
|
|
||||||
export const itemAttachmentSource = 'attachmentSource';
|
export const itemAttachmentSource = 'attachmentSource';
|
||||||
|
|
||||||
export const userFlags = {
|
export const userFlags = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue