From 75a0c37ea5e5a9fa395690984c373536e8efccfa Mon Sep 17 00:00:00 2001
From: Catalin Mititiuc
Date: Sat, 27 Apr 2024 13:10:43 -0700
Subject: Some cleanup
---
src/modules/game.js | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
(limited to 'src/modules/game.js')
diff --git a/src/modules/game.js b/src/modules/game.js
index 5bc1fe3..e66f126 100644
--- a/src/modules/game.js
+++ b/src/modules/game.js
@@ -2,8 +2,6 @@ import * as firingArc from './game/firingArc.js';
import * as sightLine from './game/sightLine.js';
import * as counterMod from './game/counter.js';
-const svgns = "http://www.w3.org/2000/svg";
-
function getCellContents(cell) {
return cell.querySelectorAll('*:not(use[href="#hex"])');
}
@@ -111,9 +109,7 @@ function drawSightLine(sourceCell, targetCell) {
distanceCallback && distanceCallback(hexes.length - 1);
}
-let svg, distanceCallback, proneFlagCallback, selectCallback;
-
-let board,
+let svg, distanceCallback, proneFlagCallback, selectCallback,
placing = [];
export function setDistanceCallback(callback) {
@@ -130,7 +126,6 @@ export function setSelectCallback(callback) {
export function start(el) {
svg = el;
- board = svg.querySelector('.board');
getCells(svg).forEach(cell => {
cell.addEventListener('click', e => {
@@ -332,16 +327,16 @@ export function toggleProne() {
}
}
-export function toggleFiringArcVisibility(allegiance) {
- firingArc.toggleVisibility(svg, allegiance);
+export function toggleFiringArcVisibility() {
+ firingArc.toggleVisibility(svg, this.dataset.allegiance);
}
-export function setFiringArc(size) {
+export function setFiringArc() {
const counter = getSelected(),
isOnBoard = counter => counter && counter.parentElement.hasAttribute('data-x');
if (isOnBoard(counter)) {
- firingArc.set(svg, size, counter, getCellPosition(counter.parentElement));
+ firingArc.set(svg, this.dataset.size, counter, getCellPosition(counter.parentElement));
}
}
--
cgit v1.2.3