2019-10-04 in class
This commit is contained in:
parent
c72515f5ae
commit
d2fe8d9f90
1 changed files with 6 additions and 4 deletions
|
@ -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);
|
||||
|
|
Reference in a new issue