mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 07:23:37 +02:00
Inverted from isImage to isIcon. Should be more logical for users
This commit is contained in:
parent
51e681cef9
commit
cce86c7032
8 changed files with 33 additions and 31 deletions
|
|
@ -96,7 +96,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
for (const element of htmlElement.querySelectorAll('.path-field input'))
|
||||
element.addEventListener('change', this.toggleResourceIsPath.bind(this));
|
||||
element.addEventListener('change', this.toggleResourceIsIcon.bind(this));
|
||||
}
|
||||
|
||||
async _prepareContext(_options) {
|
||||
|
|
@ -149,14 +149,14 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
this.render();
|
||||
}
|
||||
|
||||
async toggleResourceIsPath(event) {
|
||||
async toggleResourceIsIcon(event) {
|
||||
const element = event.target.closest('.resource-icon-container');
|
||||
const { actorType, resourceKey, imageKey } = element.dataset;
|
||||
|
||||
const current = this.settings.resources[actorType].resources[resourceKey].images[imageKey];
|
||||
await this.settings.updateSource({
|
||||
[`resources.${actorType}.resources.${resourceKey}.images.${imageKey}`]: {
|
||||
isPath: !current.isPath,
|
||||
isIcon: !current.isIcon,
|
||||
value: ''
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -969,8 +969,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
label: game.i18n.localize(resource.label),
|
||||
value: resourceData.value,
|
||||
max: resourceData.max,
|
||||
fullIcon: resource.images?.full ?? { value: 'fa-solid fa-circle' },
|
||||
emptyIcon: resource.images?.empty ?? { value: 'fa-regular fa-circle' }
|
||||
fullIcon: resource.images?.full ?? { value: 'fa-solid fa-circle', isIcon: true },
|
||||
emptyIcon: resource.images?.empty ?? { value: 'fa-regular fa-circle', isIcon: true }
|
||||
};
|
||||
|
||||
return acc;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
* reverse
|
||||
* label
|
||||
* images {
|
||||
* full { value, isPath, noColorFilter }
|
||||
* empty { value, isPath noColorFilter }
|
||||
* full { value, isIcon, noColorFilter }
|
||||
* empty { value, isIcon noColorFilter }
|
||||
* }
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ export class Resource extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
static getDefaultResourceData = label => {
|
||||
const images = Resource._schema.fields.images.getInitialValue();
|
||||
const images = Resource.schema.fields.images.getInitialValue();
|
||||
return {
|
||||
initial: 0,
|
||||
max: 0,
|
||||
|
|
@ -233,7 +233,7 @@ export class Resource extends foundry.abstract.DataModel {
|
|||
};
|
||||
|
||||
static getDefaultImageData = imageKey => {
|
||||
return Resource._schema.fields.images.fields[imageKey].getInitialValue();
|
||||
return Resource.schema.fields.images.fields[imageKey].getInitialValue();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -244,10 +244,10 @@ const imageIconField = defaultValue =>
|
|||
initial: defaultValue,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.resources.resources.value.label'
|
||||
}),
|
||||
isPath: new foundry.data.fields.BooleanField({
|
||||
isIcon: new foundry.data.fields.BooleanField({
|
||||
required: true,
|
||||
initial: false,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.resources.resources.isPath.label'
|
||||
initial: true,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.resources.resources.isIcon.label'
|
||||
}),
|
||||
noColorFilter: new foundry.data.fields.BooleanField({
|
||||
required: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue