Skip to content
Snippets Groups Projects
Commit 8639d61c authored by Silas Dohm's avatar Silas Dohm
Browse files

changed names

parent 2e5f3a92
No related branches found
No related tags found
No related merge requests found
...@@ -18,9 +18,7 @@ let columns, rows; ...@@ -18,9 +18,7 @@ let columns, rows;
let finished = false; let finished = false;
initPuzzle(); initPuzzle();
//todo : change active Word after action function kbEvent(e) {
document.addEventListener('keydown', logKey);
function logKey(e) {
lastCell = activeCell; lastCell = activeCell;
switch (activeMode) { switch (activeMode) {
case mode.insert: case mode.insert:
...@@ -131,6 +129,8 @@ function logKey(e) { ...@@ -131,6 +129,8 @@ function logKey(e) {
} }
endInput(); endInput();
} }
document.addEventListener('keydown', kbEvent);
canv.addEventListener('mousedown', function (e) { //mouse navigation canv.addEventListener('mousedown', function (e) { //mouse navigation
let x = Math.floor(e.offsetX / (canv.clientWidth / columns)); let x = Math.floor(e.offsetX / (canv.clientWidth / columns));
let y = Math.floor(e.offsetY / (canv.clientHeight / rows)); let y = Math.floor(e.offsetY / (canv.clientHeight / rows));
...@@ -173,7 +173,7 @@ function endInput() { ...@@ -173,7 +173,7 @@ function endInput() {
if (activeCell.word[1]) if (activeCell.word[1])
activeCell.word[1].highlight(); activeCell.word[1].highlight();
} }
checkWinner(); check4Win();
} }
function initNeighbours() { function initNeighbours() {
for (let x = 0; x < columns; x++) { //precompute neighbours for (let x = 0; x < columns; x++) { //precompute neighbours
...@@ -216,7 +216,7 @@ function initNeighbours() { ...@@ -216,7 +216,7 @@ function initNeighbours() {
} }
} }
function checkWinner() { function check4Win() {
for (i = 0; i < columns; i++) { for (i = 0; i < columns; i++) {
for (j = 0; j < rows; j++) { for (j = 0; j < rows; j++) {
if (cells[i][j].actualChar.toUpperCase() != cells[i][j].currentChar.toUpperCase()) { if (cells[i][j].actualChar.toUpperCase() != cells[i][j].currentChar.toUpperCase()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment