I am going thru a development feature for a map based application wherein I need to do two things:
- Detect which all shapes are overlapped on one another (coordinates match).
- Click on the top of them to split them up
Here is the picture of the requirement to get the clear understanding of it:
So in this image, left state is the default one and the right one is, once we click on them and that state becomes split state wherein all the shapes are kinda scattered but connected with the label name which is "G108" in this case.
These two shapes data will be coming from two different APIs. What I need to do detect is the overlapping. So do I need to loop over the children inside a "stage" element provided by the createJs which seems to a time consuming? So on what basis should detection be checked? There could be 3 or 4 shapes getting plotted from various APIs and have no relation with one another.
For splitting, what could be the approach to handle it?
Here is the stackblitz link, in case you might want to try it out. I've implemented a default scenario.
Libraries being used:
- Leaflet for map features
- Custom Layer for canvas
- For implementing these two shapes, create JS
I would really appreciate if you could suggest me or share an approach or help in this regard.