Skip to content

Commit

Permalink
Improve toggle logic of max castings calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
juanferrer committed Aug 29, 2024
1 parent 08d3acb commit 7a53492
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/module/item/sheets/base-item-sheet-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down Expand Up @@ -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: {
Expand All @@ -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: {
Expand Down

0 comments on commit 7a53492

Please sign in to comment.