Skip to content

Commit

Permalink
Merge pull request #51 from ivan1993spb/issue_50
Browse files Browse the repository at this point in the history
Issue #50 Bugfix: cleared cells aren't redrawn with black color
  • Loading branch information
ivan1993spb authored Dec 21, 2020
2 parents 2b10548 + 2dda7f8 commit 509bd97
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/game/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const OBJECT_HIGHLIGHTED = 6
export const OBJECT_MOUSE = 7
export const OBJECT_UNKNOWN = 8

export const COLOR_BACKGROUND = '#000'
export const COLOR_BORDER = '#343'
export const COLOR_GRID = '#020'
export const COLOR_PLAYER = '#900'
Expand Down Expand Up @@ -104,8 +105,9 @@ export class Canvas {
}

_clear (context, dots) {
this._contextGame.fillStyle = COLOR_BACKGROUND
dots.forEach(dot => {
context.clearRect(
context.fillRect(
this._getPxX(dot[X]),
this._getPxY(dot[Y]),
this._dot,
Expand Down Expand Up @@ -200,7 +202,8 @@ export class Canvas {
}

_clearAll () {
this._contextGame.clearRect(0, 0, this._contextGame.canvas.width,
this._contextGame.fillStyle = COLOR_BACKGROUND
this._contextGame.fillRect(0, 0, this._contextGame.canvas.width,
this._contextGame.canvas.height)
}
}
Expand Down

0 comments on commit 509bd97

Please sign in to comment.