Skip to content

Commit

Permalink
Fix redraw bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Filip Smets committed Feb 2, 2016
1 parent 6acc48e commit e4af593
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions TiledCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,12 @@ TiledCanvas.prototype.normalizeDefaults = function normalizeDefaults (target, de
// will actually be executed
TiledCanvas.prototype.redrawOnce = function redrawOnce () {
if (!this._redrawTimeout)
this._redrawTimeout = setTimeout(this.redraw);
this._redrawTimeout = setTimeout(this.redraw.bind(this));
};

TiledCanvas.prototype.redraw = function redraw (noclear) {
if (this._redrawTimeout) {
clearTimeout(this._redrawTimeout);
delete this._redrawTimeout;
}
clearTimeout(this._redrawTimeout);
delete this._redrawTimeout;

if (!noclear) this.ctx.clearRect(0, 0, this.ctx.canvas.width, this.ctx.canvas.height);

Expand Down

0 comments on commit e4af593

Please sign in to comment.