Skip to content

Commit 2e69fdf

Browse files
committed
fixing resetTile to only remove paint from the subject cell
1 parent 3f9a60e commit 2e69fdf

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/neighborhoodDrawer.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,12 @@ module.exports = class NeighborhoodDrawer extends Drawer {
209209
* @param col
210210
*/
211211
resetTile(row, col) {
212-
let neighbors = [
213-
"g" + row + "." + col,
214-
"g" + (row - 1) + "." + (col - 1),
215-
"g" + row + "." + (col - 1),
216-
"g" + (row - 1) + "." + col,
217-
];
212+
let subjectTile = "g" + row + "." + col;
218213
const cell = this.neighborhood.getCell(row, col);
219214
cell.setColor(null);
220-
for (const neighbor of neighbors) {
221-
var node = document.getElementById(neighbor);
222-
if (node) {
223-
node.querySelectorAll("*").forEach((n) => n.remove());
224-
}
215+
var node = document.getElementById(subjectTile);
216+
if (node) {
217+
node.querySelectorAll("*").forEach((n) => n.remove());
225218
}
226219
}
227220

0 commit comments

Comments
 (0)