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));
|
this.canvas.addEventListener('mousemove', (e) => this.mousedown && this.draw(e));
|
||||||
|
|
||||||
const endPath = (e) => {
|
const endPath = (e) => {
|
||||||
this.ctx.lineTo(e.offsetX, e.offsetY);
|
if (this.mousedown) {
|
||||||
this.ctx.stroke();
|
this.ctx.lineTo(e.offsetX, e.offsetY);
|
||||||
this.ctx.restore();
|
this.ctx.stroke();
|
||||||
this.mousedown = false;
|
this.ctx.restore();
|
||||||
|
this.mousedown = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.canvas.addEventListener('mouseup', endPath);
|
this.canvas.addEventListener('mouseup', endPath);
|
||||||
|
|
Reference in a new issue