Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-04-30 21:10:11 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-04-30 21:22:00 -0700
commita3bf726e40fe4ed529bdefa83c977af4b72791a9 (patch)
treeab42c7cc50545a670ffd6b8804a769ec0b086b3f /src/modules/game/soldier.js
parent1eda0dafd539b6a259fe1ad4609419c8f04c49c7 (diff)
Allow placing a counter that doesn't already exist
Diffstat (limited to 'src/modules/game/soldier.js')
-rw-r--r--src/modules/game/soldier.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js
index 8e2725d..1555c19 100644
--- a/src/modules/game/soldier.js
+++ b/src/modules/game/soldier.js
@@ -63,6 +63,18 @@ function createTrace(previous, current, selected) {
return trace;
}
+export function createCounter(selected) {
+ const use = document.createElementNS(svgns, 'use');
+ const g = document.createElementNS(svgns, 'g');
+ use.setAttributeNS(null, 'href', `#t-${selected.dataset.number}`);
+ g.classList.add('counter');
+ g.dataset.allegiance = selected.dataset.allegiance;
+ g.dataset.number = selected.dataset.number;
+ g.appendChild(use);
+
+ return g;
+}
+
export function handleTrace(svg, selected, clone, current) {
let trace = getTrace(svg, selected);