mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-22 23:43:37 +02:00
Use toggle for css class addition/removal
This commit is contained in:
parent
6479f9d750
commit
f1a0c4d878
1 changed files with 3 additions and 8 deletions
|
|
@ -1036,14 +1036,9 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
|
|
||||||
const container = target.closest('.slot-bar');
|
const container = target.closest('.slot-bar');
|
||||||
for (const armorSlot of container.querySelectorAll('.armor-slot i')) {
|
for (const armorSlot of container.querySelectorAll('.armor-slot i')) {
|
||||||
const index = Number.parseInt(armorSlot.dataset.index);
|
const marked = !decreasing && Number.parseInt(armorSlot.dataset.index) < newCurrent;
|
||||||
if (decreasing && index >= newCurrent) {
|
armorSlot.classList.toggle('fa-shield', marked);
|
||||||
armorSlot.classList.remove('fa-shield');
|
armorSlot.classList.toggle('fa-shield-halved', !marked);
|
||||||
armorSlot.classList.add('fa-shield-halved');
|
|
||||||
} else if (!decreasing && index < newCurrent) {
|
|
||||||
armorSlot.classList.add('fa-shield');
|
|
||||||
armorSlot.classList.remove('fa-shield-halved');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await effect.update({ 'system.changes': newChanges });
|
await effect.update({ 'system.changes': newChanges });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue