Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/game/soldier.js14
-rw-r--r--src/modules/gameboard.js5
-rw-r--r--src/modules/pan-zoom.js5
3 files changed, 15 insertions, 9 deletions
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js
index 81dce74..8e5774b 100644
--- a/src/modules/game/soldier.js
+++ b/src/modules/game/soldier.js
@@ -124,14 +124,14 @@ export function place(svg, selected, cell) {
// piecesContainer.append(container);
//}
- if (svg.querySelector('.grid').contains(selected)) {
- const clone = addMoveToHistory(selected);
- updatePlacement(cell, selected, clone)
- handleTrace(svg, selected, clone, getCellPosition(cell));
- } else {
- selected.removeAttribute('data-x');
+ //if (svg.querySelector('.grid').contains(selected)) {
+ // const clone = addMoveToHistory(selected);
+ // updatePlacement(cell, selected, clone)
+ // handleTrace(svg, selected, clone, getCellPosition(cell));
+ //} else {
+ // selected.removeAttribute('data-x');
placeIn(cell, selected);
- }
+ //}
}
export function removeClones(svg, counter) {
diff --git a/src/modules/gameboard.js b/src/modules/gameboard.js
index e3db1a5..4d6790a 100644
--- a/src/modules/gameboard.js
+++ b/src/modules/gameboard.js
@@ -324,7 +324,10 @@ export function start(el) {
// const defender = { dataset: { allegiance: 'defender', number: 1, squad: 2 }};
//const cell = getCell(0, 0, 0, 0);
//const trooper = soldier.createCounter(attacker, 'blazer');
- //soldier.place(svg, trooper, cell);
+ //const trooperSack = document.createElementNS(svgns, 'g');
+ //trooperSack.classList.add('cell-contents');
+ //trooperSack.append(trooper);
+ //soldier.place(svg, trooperSack, cell);
// Add some counters in an unoccupied cell
//const countersCell = getCell(-1, 1, 0, 0);
diff --git a/src/modules/pan-zoom.js b/src/modules/pan-zoom.js
index e86afe9..11471f6 100644
--- a/src/modules/pan-zoom.js
+++ b/src/modules/pan-zoom.js
@@ -13,7 +13,10 @@ function restorePanZoomVal(el) {
function addEventListeners(svg, el) {
svg.addEventListener('wheel', e => zoom(el, e, zoomFactor), { passive: false });
- svg.addEventListener('pointerdown', e => pan(svg, el, e), { passive: false });
+ svg.addEventListener('pointerdown', e => {
+ e.target.setPointerCapture(e.pointerId);
+ pan(svg, el, e), { passive: false };
+ });
}
function storePanZoomVal(transformMatrix) {