Hey guys, it turns out the problem with the mouse is that I was trying to get the mouse location in the document, but I should've gotten the mouse position relative to the canvas. Sorry for that.