2022-07-28 17:39:51 +02:00
|
|
|
import Grid;
|
|
|
|
import GUI;
|
2022-08-10 21:12:39 +02:00
|
|
|
import at from Grid.Util;
|
2022-07-28 17:39:51 +02:00
|
|
|
|
|
|
|
return {
|
|
|
|
events: {
|
|
|
|
onClick: onClick
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-08-10 21:12:39 +02:00
|
|
|
function onClick(e, cell) {
|
2022-09-01 21:51:48 +02:00
|
|
|
if(Grid.get().missing.size() < 1) {
|
2022-08-10 21:12:39 +02:00
|
|
|
rotateState(at(Grid.get().cells, cell));
|
2022-07-28 17:39:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
}
|