mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Save position, size details for the 3 types of compendium browser
This commit is contained in:
parent
4f6ddba087
commit
087e13debe
2 changed files with 23 additions and 6 deletions
|
|
@ -16,6 +16,7 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
this.selectedMenu = { path: [], data: null };
|
||||
this.config = CONFIG.DH.ITEMBROWSER.compendiumConfig;
|
||||
this.presets = {};
|
||||
this.compendiumBrowserTypeKey = 'compendiumBrowserDefault';
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
|
|
@ -84,11 +85,20 @@ 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);
|
||||
const noFolder = this.presets?.render?.noFolder;
|
||||
if (noFolder === true) {
|
||||
this.compendiumBrowserTypeKey = 'compendiumBrowserNoFolder';
|
||||
}
|
||||
const lite = this.presets?.render?.lite;
|
||||
if (lite === true) {
|
||||
this.compendiumBrowserTypeKey = 'compendiumBrowserLite';
|
||||
}
|
||||
const userPresetPosition = game.user.getFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`${this.compendiumBrowserTypeKey}`].position) ;
|
||||
|
||||
options.position = userPresetPosition ?? ItemBrowser.DEFAULT_OPTIONS.position;
|
||||
|
||||
if (!userPresetPosition) {
|
||||
const width = this.presets?.render?.noFolder === true || this.presets?.render?.lite === true ? 600 : 850;
|
||||
const width = noFolder === true || lite === true ? 600 : 850;
|
||||
if(this.rendered)
|
||||
this.setPosition({ width });
|
||||
else
|
||||
|
|
@ -117,10 +127,9 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
|||
}
|
||||
|
||||
_onPosition(position) {
|
||||
game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`compendiumBrowser`].position, position);
|
||||
game.user.setFlag(CONFIG.DH.id, CONFIG.DH.FLAGS[`${this.compendiumBrowserTypeKey}`].position, position);
|
||||
}
|
||||
|
||||
|
||||
_attachPartListeners(partId, htmlElement, options) {
|
||||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue