Fix game board display issues

This commit is contained in:
Andrio Celos
2022-10-21 12:12:29 +11:00
parent 978e08fddf
commit 5b36ec6bf1
3 changed files with 8 additions and 9 deletions

View File

@@ -85,8 +85,7 @@ class Board {
const x2 = this.touch[3] + dx;
const y2 = this.touch[4] + dy;
if (this.highlightX != x2 || this.highlightY != y2) {
this.highlightX = x2;
this.highlightY = y2;
this.moveHighlight((x, y, r) => [x2, y2, r], true);
}
this.refreshHighlight();
}
@@ -200,10 +199,9 @@ class Board {
this.grid = grid || this.grid;
while (this.table.firstChild) {
this.table.removeChild(this.table.firstChild);
}
clearChildren(this.table);
this.cells.splice(0);
this.highlightedCells.splice(0);
const boardWidth = grid.length;
const boardHeight = grid[0].length;

View File

@@ -73,8 +73,7 @@ function showReady(playerIndex: number) {
function clearPlayContainers() {
for (const container of playContainers) {
while (container.firstChild)
container.removeChild(container.firstChild);
clearChildren(container);
}
}