2019-10-04 in class

This commit is contained in:
Claudio Maggioni 2019-10-04 17:29:36 +02:00
parent c72515f5ae
commit d2fe8d9f90
1 changed files with 6 additions and 4 deletions

View File

@ -45,10 +45,12 @@ class App {
this.canvas.addEventListener('mousemove', (e) => this.mousedown && this.draw(e));
const endPath = (e) => {
this.ctx.lineTo(e.offsetX, e.offsetY);
this.ctx.stroke();
this.ctx.restore();
this.mousedown = false;
if (this.mousedown) {
this.ctx.lineTo(e.offsetX, e.offsetY);
this.ctx.stroke();
this.ctx.restore();
this.mousedown = false;
}
};
this.canvas.addEventListener('mouseup', endPath);