mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 11:41:08 +01:00
[Fix] Updating item quantity in party inventory (#1378)
* Fix updating item quantity in party inventory * Remove unnecessary second render
This commit is contained in:
parent
14ac8977af
commit
28976bb4b8
2 changed files with 13 additions and 12 deletions
|
|
@ -139,10 +139,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
element.addEventListener('change', this.updateItemResource.bind(this));
|
element.addEventListener('change', this.updateItemResource.bind(this));
|
||||||
element.addEventListener('click', e => e.stopPropagation());
|
element.addEventListener('click', e => e.stopPropagation());
|
||||||
});
|
});
|
||||||
htmlElement.querySelectorAll('.inventory-item-quantity').forEach(element => {
|
|
||||||
element.addEventListener('change', this.updateItemQuantity.bind(this));
|
|
||||||
element.addEventListener('click', e => e.stopPropagation());
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add listener for armor marks input
|
// Add listener for armor marks input
|
||||||
htmlElement.querySelectorAll('.armor-marks-input').forEach(element => {
|
htmlElement.querySelectorAll('.armor-marks-input').forEach(element => {
|
||||||
|
|
@ -593,14 +589,6 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateItemQuantity(event) {
|
|
||||||
const item = await getDocFromElement(event.currentTarget);
|
|
||||||
if (!item) return;
|
|
||||||
|
|
||||||
await item.update({ 'system.quantity': event.currentTarget.value });
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
|
|
||||||
async updateArmorMarks(event) {
|
async updateArmorMarks(event) {
|
||||||
const armor = this.document.system.armor;
|
const armor = this.document.system.armor;
|
||||||
if (!armor) return;
|
if (!armor) return;
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,10 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
_attachPartListeners(partId, htmlElement, options) {
|
_attachPartListeners(partId, htmlElement, options) {
|
||||||
super._attachPartListeners(partId, htmlElement, options);
|
super._attachPartListeners(partId, htmlElement, options);
|
||||||
|
|
||||||
|
htmlElement.querySelectorAll('.inventory-item-quantity').forEach(element => {
|
||||||
|
element.addEventListener('change', this.updateItemQuantity.bind(this));
|
||||||
|
element.addEventListener('click', e => e.stopPropagation());
|
||||||
|
});
|
||||||
htmlElement.querySelectorAll('.item-button .action-uses-button').forEach(element => {
|
htmlElement.querySelectorAll('.item-button .action-uses-button').forEach(element => {
|
||||||
element.addEventListener('contextmenu', DHBaseActorSheet.#modifyActionUses);
|
element.addEventListener('contextmenu', DHBaseActorSheet.#modifyActionUses);
|
||||||
});
|
});
|
||||||
|
|
@ -172,6 +176,15 @@ export default class DHBaseActorSheet extends DHApplicationMixin(ActorSheetV2) {
|
||||||
return this._getContextMenuCommonOptions.call(this, { usable: true, toChat: true });
|
return this._getContextMenuCommonOptions.call(this, { usable: true, toChat: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
/* Application Listener Actions */
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
|
async updateItemQuantity(event) {
|
||||||
|
const item = await getDocFromElement(event.currentTarget);
|
||||||
|
await item?.update({ 'system.quantity': event.currentTarget.value });
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
/* Application Clicks Actions */
|
/* Application Clicks Actions */
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue