index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/modules/firingArc.js')
-rw-r--r-- | src/modules/firingArc.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/modules/firingArc.js b/src/modules/firingArc.js index b319427..109e04f 100644 --- a/src/modules/firingArc.js +++ b/src/modules/firingArc.js @@ -56,7 +56,7 @@ function position(e) { // TODO: handle exactly horizontal and vertical lines if (activeFiringArc) { - let activeFiringArcOutline = this.querySelector(`#lines polygon[data-troop-number="${activeFiringArc.dataset.troopNumber}"][data-troop-allegiance="${activeFiringArc.dataset.troopAllegiance}"]`), + let activeFiringArcOutline = this.querySelector(`#lines polygon[data-number="${activeFiringArc.dataset.number}"][data-allegiance="${activeFiringArc.dataset.allegiance}"]`), board = this.querySelector('#image-maps'), { width, height } = board.getBBox(), pt = new DOMPoint(e.clientX, e.clientY), @@ -169,11 +169,11 @@ export default class FiringArc { this.svg = svg; } - set(size, troopAllegiance, troopNumber, { x, y }) { + set(size, allegiance, number, { x, y }) { const svgns = "http://www.w3.org/2000/svg"; let existingArcs = this.svg.querySelectorAll( - `#firing-arcs [data-troop-number="${troopNumber}"][data-troop-allegiance="${troopAllegiance}"]` + `#firing-arcs [data-number="${number}"][data-allegiance="${allegiance}"]` ); existingArcs.forEach(el => el.remove()); @@ -193,13 +193,13 @@ export default class FiringArc { let firingArcOutline = document.createElementNS(svgns, 'polygon'); firingArc.classList.add('firing-arc', 'active'); - firingArc.dataset.troopNumber = troopNumber; - firingArc.dataset.troopAllegiance = troopAllegiance; + firingArc.dataset.number = number; + firingArc.dataset.allegiance = allegiance; firingArc.dataset.size = size; firingArc.setAttributeNS(null, 'points', `${pivotPoint} ${pivotPoint} ${pivotPoint}`); - firingArcOutline.dataset.troopNumber = troopNumber; - firingArcOutline.dataset.troopAllegiance = troopAllegiance; + firingArcOutline.dataset.number = number; + firingArcOutline.dataset.allegiance = allegiance; firingArcOutline.setAttributeNS(null, 'points', `${pivotPoint} ${pivotPoint} ${pivotPoint}`); let clipShape = document.createElementNS(svgns, 'circle'); @@ -208,9 +208,9 @@ export default class FiringArc { clipShape.setAttributeNS(null, 'r', 100); let clipPath = document.createElementNS(svgns, 'clipPath'); - clipPath.setAttributeNS(null, 'id', `clip-path-${troopAllegiance}-${troopNumber}`); - clipPath.dataset.troopNumber = troopNumber; - clipPath.dataset.troopAllegiance = troopAllegiance; + clipPath.setAttributeNS(null, 'id', `clip-path-${allegiance}-${number}`); + clipPath.dataset.number = number; + clipPath.dataset.allegiance = allegiance; clipPath.appendChild(clipShape); arcContainer.appendChild(clipPath); @@ -232,7 +232,7 @@ export default class FiringArc { firingArc.removeEventListener('contextmenu', cancelFiringArcPlacement); let existingArcs = this.svg.querySelectorAll( - `#firing-arcs [data-troop-number="${troopNumber}"][data-troop-allegiance="${troopAllegiance}"]` + `#firing-arcs [data-number="${number}"][data-allegiance="${allegiance}"]` ); existingArcs.forEach(el => el.remove()); |