How wide was the canvas ?
To get the same functionality with canvas , one must manually match the coordinates of the mouse click with the coordinates of the drawn rectangle to determine whether it was clicked .