Canvas deletes a line

I want to draw multiple lines in canvas, and then click on one to delete it. How to achieve

most easily?
May.22,2021

record the line in an array, and
figure out which line it is by mouse click position.
Delete this line data and redraw.

Menu