Stop drawing when mouse is released outside of the canvas

This commit is contained in:
Jelena Milanovic 2020-12-27 13:54:27 +01:00
parent 5677ca013d
commit 6a827fa4b2

View File

@ -20,7 +20,7 @@ canvas.addEventListener('mousedown', (e) => {
y = e.offsetY
})
canvas.addEventListener('mouseup', (e) => {
document.addEventListener('mouseup', (e) => {
isPressed = false
x = undefined