mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +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.selectedMenu = { path: [], data: null };
|
||||||
this.config = CONFIG.DH.ITEMBROWSER.compendiumConfig;
|
this.config = CONFIG.DH.ITEMBROWSER.compendiumConfig;
|
||||||
this.presets = {};
|
this.presets = {};
|
||||||
|
this.compendiumBrowserTypeKey = 'compendiumBrowserDefault';
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @inheritDoc */
|
/** @inheritDoc */
|
||||||
|
|
@ -84,11 +85,20 @@ 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);
|
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;
|
options.position = userPresetPosition ?? ItemBrowser.DEFAULT_OPTIONS.position;
|
||||||
|
|
||||||
if (!userPresetPosition) {
|
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)
|
if(this.rendered)
|
||||||
this.setPosition({ width });
|
this.setPosition({ width });
|
||||||
else
|
else
|
||||||
|
|
@ -117,10 +127,9 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_onPosition(position) {
|
_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) {
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,16 @@ export const encounterCountdown = {
|
||||||
position: 'countdown-encounter-position'
|
position: 'countdown-encounter-position'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const compendiumBrowser = {
|
export const compendiumBrowserDefault = {
|
||||||
position: 'compendium-browser-position'
|
position: 'compendium-browser-default-position'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const compendiumBrowserNoFolder = {
|
||||||
|
position: 'compendium-browser-no-folder-position'
|
||||||
|
};
|
||||||
|
|
||||||
|
export const compendiumBrowserLite = {
|
||||||
|
position: 'compendium-browser-lite-position'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const itemAttachmentSource = 'attachmentSource';
|
export const itemAttachmentSource = 'attachmentSource';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue