Javascript animation ( select function )

Hello , I have a script here that allows me to draw on a canvas. I would like to know how I could add to my script a command which when I click on the button “Selection in rectangle” I can select my draw using a rectangle form . And when i click on the ''move rectangle ‘’ button , i can make my selection move to where i want inside the canvas using the mouse. the draw lines must be inside the selection rectangle if i want my draw to be selected .

And if possible, each time I make a rectangle selection, the previously selected drawing must be deselected by the system to allow me to start a new selection from zero again.

Here’s the script and I hope you could help me, I’m stuck

1 Like