Learning the Element.getBoundingClientRect() method, for getting mouse position within canvas. 

developer.mozilla.org/en-US/doc…