From dc56db385cf8e0848e9fa0dccb34a81a51390aa5 Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Wed, 3 Apr 2024 13:18:35 -0700
Subject: Fix unselecting selected record
---
index.js | 10 ++++++++--
1 file 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');
--
cgit v1.2.3