Constellations/js/Mode/Play.js

28 lines
432 B
JavaScript
Raw Normal View History

import Grid;
import GUI;
return {
events: {
onClick: onClick
}
};
function onClick(e, row, column) {
if(Grid.get().missing.isEmpty()) {
rotateState(Grid.cell(row, column));
}
}
function rotateState(cell) {
if(cell.classList.contains('off')) {
if(cell.textContent == '*') {
cell.classList.remove('off');
cell.textContent = '';
} else {
cell.textContent = '*';
}
} else {
cell.classList.add('off');
}
}