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

renamed drawChar to draw

parent 02caa7c7
Branches
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ class Cell { ...@@ -8,7 +8,7 @@ class Cell {
this.word = new Array(2) this.word = new Array(2)
this.neighbour = new Array(4); //0=left, 1=top, 2=right, 3=bot this.neighbour = new Array(4); //0=left, 1=top, 2=right, 3=bot
} }
drawChar = function (color, fontcolor = "black", strokeColor = "black") { draw = function (color, fontcolor = "black", strokeColor = "black") {
//drawCell //drawCell
ctx.fillStyle = color; ctx.fillStyle = color;
ctx.strokeStyle = strokeColor; ctx.strokeStyle = strokeColor;
...@@ -51,7 +51,7 @@ class Word { ...@@ -51,7 +51,7 @@ class Word {
mycell[x][y].actualChar = c; mycell[x][y].actualChar = c;
mycell[x][y].word[direction] = this; mycell[x][y].word[direction] = this;
this.chars.push(mycell[x][y]); this.chars.push(mycell[x][y]);
mycell[x][y].drawChar("white"); mycell[x][y].draw("white");
direction ? y += 1 : x += 1; direction ? y += 1 : x += 1;
} }
this.li.onclick = function (e) { this.li.onclick = function (e) {
...@@ -72,9 +72,9 @@ class Word { ...@@ -72,9 +72,9 @@ class Word {
this.li.style.background = this.highlightColor; this.li.style.background = this.highlightColor;
this.chars.forEach(element => { this.chars.forEach(element => {
if (element == activeCell) if (element == activeCell)
element.drawChar(m_orientation ? '#ffe553' : '#ffab58'); element.draw(m_orientation ? '#ffe553' : '#ffab58');
else { else {
element.drawChar(this.highlightColor); element.draw(this.highlightColor);
} }
if (element.currentChar == "") if (element.currentChar == "")
filled = false; filled = false;
...@@ -85,10 +85,10 @@ class Word { ...@@ -85,10 +85,10 @@ class Word {
if (element == activeCell) if (element == activeCell)
color = m_orientation ? '#ffe553' : '#ffab58'; color = m_orientation ? '#ffe553' : '#ffab58';
if (element.currentChar.toUpperCase() == element.actualChar.toUpperCase()) { if (element.currentChar.toUpperCase() == element.actualChar.toUpperCase()) {
element.drawChar(color, "green"); element.draw(color, "green");
} }
else else
element.drawChar(color, "#bf060b"); element.draw(color, "#bf060b");
}); });
} }
//highlight //highlight
...@@ -106,7 +106,7 @@ class Word { ...@@ -106,7 +106,7 @@ class Word {
this.li.style.background = 'none'; this.li.style.background = 'none';
this.li.style.borderColor = "transparent"; this.li.style.borderColor = "transparent";
this.chars.forEach(element => { this.chars.forEach(element => {
element.drawChar('white'); element.draw('white');
}); });
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment