Skip to content

Instantly share code, notes, and snippets.

@avalchev94
Created March 12, 2020 20:18
Show Gist options
  • Save avalchev94/697b2c5d178604ff8574f10f7feab8a1 to your computer and use it in GitHub Desktop.
Save avalchev94/697b2c5d178604ff8574f10f7feab8a1 to your computer and use it in GitHub Desktop.
var dragged = null
canvas.onmousedown = e => {
if (scene.overlap(e.x, e.y)) {
dragged = scene.pt
}
}
canvas.onmousemove = e => {
if (dragged != null) {
dragged.x = e.x
dragged.y = e.y
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment