Web Dev Solutions

Catalin Mititiuc

From 3f3af09f2bd8ac8ae7c1d2cb49d26cbca155a881 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Wed, 24 Apr 2024 13:37:06 -0700 Subject: Remove 'previous' from counter's dataset when move has ended --- src/modules/counter.js | 4 ++-- src/modules/game.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/counter.js b/src/modules/counter.js index 6a1da45..416ddb3 100644 --- a/src/modules/counter.js +++ b/src/modules/counter.js @@ -191,7 +191,6 @@ export default class Counter { let counter = this.getCounter(allegiance, number); if (counter) { - this.container.placing.push(counter); counter.classList.add(selectedClass); let existingArcs = this.container.getExistingArcs(allegiance, number); existingArcs.forEach(el => el.removeAttribute('clip-path')); @@ -201,7 +200,6 @@ export default class Counter { unSelect() { let selected = this.container.getSelected(); - this.container.placing = []; if (selected) { let { troopNumber, troopAllegiance } = selected.dataset; @@ -309,6 +307,8 @@ export default class Counter { trace.remove(); } + delete el.dataset.previous; + if (proneCounter) { proneCounter.dataset.preexisting = ''; } diff --git a/src/modules/game.js b/src/modules/game.js index 657aa9d..237e346 100644 --- a/src/modules/game.js +++ b/src/modules/game.js @@ -99,10 +99,12 @@ export default class Game { } select(allegiance, number) { + this.placing.push(this.counter.getCounter(allegiance, number)); this.counter.select({ dataset: { allegiance, number } }); } unSelect() { + this.placing = []; this.counter.unSelect(); } -- cgit v1.2.3