From 7a53492018b4c8a61b49a3c8920c4a3a113e0376 Mon Sep 17 00:00:00 2001 From: juanferrer Date: Thu, 29 Aug 2024 23:04:54 +0100 Subject: [PATCH] Improve toggle logic of max castings calculation --- src/module/item/sheets/base-item-sheet-v2.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/module/item/sheets/base-item-sheet-v2.js b/src/module/item/sheets/base-item-sheet-v2.js index 591a0d47..4f4b876b 100644 --- a/src/module/item/sheets/base-item-sheet-v2.js +++ b/src/module/item/sheets/base-item-sheet-v2.js @@ -414,7 +414,7 @@ export default class DLBaseItemSheetV2 extends HandlebarsApplicationMixin(ItemSh // Max castings e.querySelector('.max-castings-control')?.addEventListener('change', async ev => await this._onManageMaxCastings(ev, this)) - e.querySelector('.max-castings-control')?.addEventListener('contextmenu', async ev => await this._onToggleMaxCastingsCalculation(ev, this)) + e.querySelector('.item-group-spell-castings')?.addEventListener('contextmenu', async ev => await this._onToggleMaxCastingsCalculation(ev, this)) // Contents item quantity and delete functions e.querySelectorAll('.item-uses')?.forEach(el => el.addEventListener('mousedown', async ev => await this._onUpdateContentsItemQuantity(ev))) @@ -498,9 +498,7 @@ export default class DLBaseItemSheetV2 extends HandlebarsApplicationMixin(ItemSh async _onManageMaxCastings (ev, sheet) { // Set the flag if textbox has been modified. Clear if blank. const target = ev.currentTarget - const spell = sheet.object - console.log(ev); - console.log(spell); + const spell = sheet.document await spell.update({ system: { castings: { @@ -512,9 +510,7 @@ export default class DLBaseItemSheetV2 extends HandlebarsApplicationMixin(ItemSh async _onToggleMaxCastingsCalculation (ev, sheet) { // Set the flag if textbox has been modified. Clear if blank. - const spell = sheet.object - console.log(ev); - console.log(spell); + const spell = sheet.document await spell.update({ system: { castings: {