Web Dev Solutions

Catalin Mititiuc

From 9304d937fc4dd793dbfba13be30b0073d1f76597 Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Tue, 30 Apr 2024 17:31:38 -0700 Subject: Fix cancel firing arc placement bug --- src/modules/game/firing_arc.js | 2 +- src/modules/gameboard.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/game/firing_arc.js b/src/modules/game/firing_arc.js index cea8bd0..7a82c43 100644 --- a/src/modules/game/firing_arc.js +++ b/src/modules/game/firing_arc.js @@ -294,7 +294,7 @@ function set(svg, size, counter, { x, y }) { function cancelPlacementListener(e) { e.preventDefault(); - get(counter).forEach(el => el.remove()); + get(svg, counter).forEach(el => el.remove()); grid.removeAttribute('style'); svg.removeEventListener('mousemove', positionListener); } diff --git a/src/modules/gameboard.js b/src/modules/gameboard.js index b7ef148..d4592fc 100644 --- a/src/modules/gameboard.js +++ b/src/modules/gameboard.js @@ -222,7 +222,7 @@ export function start(el) { const toPlace = placing.pop(), occupant = getCellOccupant(cell); - if (toPlace && occupant && toPlace == occupant) { + if (toPlace && occupant && toPlace === occupant) { const { number, allegiance } = toPlace.dataset, selector = `[data-allegiance="${allegiance}"][data-number="${number}"]`; -- cgit v1.2.3