Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <Catalin.Mititiuc@gmail.com>2024-04-03 13:18:35 -0700
committerCatalin Mititiuc <Catalin.Mititiuc@gmail.com>2024-04-03 13:18:35 -0700
commitdc56db385cf8e0848e9fa0dccb34a81a51390aa5 (patch)
tree026798a39d11672b93412ae06a11043248db644e
parent24aa825bc6b66ff636fed495fd8cc1d49b773bc3 (diff)
Fix unselecting selected record
-rw-r--r--index.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/index.js b/index.js
index df7d3e7..abd9794 100644
--- a/index.js
+++ b/index.js
@@ -709,8 +709,14 @@ POINTS.forEach((row, index) => row.forEach(([x, y]) => {
document.querySelectorAll('.soldier-record').forEach(el =>
el.addEventListener('click', e => {
- RecordSheet.select(el);
- Counter.select(el);
+ if (el.classList.contains('selected')) {
+ el.classList.remove('selected');
+ RecordSheet.unSelect();
+ Counter.unSelect();
+ } else {
+ RecordSheet.select(el);
+ Counter.select(el);
+ }
let sl = svg.querySelector('.sight-line');