I was trying to create a function that can fill an area like the bucket/fill option on the paint application.
Here is another example of what I'm trying to create (from skribbl.io).
I already have code that draws and create shapes and everything, here is the code snippet in case you wanted to test it, it's messy and not organized because I didn't finish creating the project yet, therefore if you know how to create a function to fill a closed area like shown in the image that would be appreciated.
Codepen: https://codepen.io/karimx32/pen/dyZewPE
Live example of what I need (video): https://ultrax-yt.com/assets/example.mov
so what I need is to create something like:
function fill() {
// code that will fill the area when I click on it
}