I'm using the Google Maps Drawing Manager to allow users to draw a polygon.
The users can draw a polygon, but it has to be a "simple" polygon, not "complex" i.e. it cannot be self-intersecting.
The Google Maps library doesn't seem to have any built-in support for detecting/preventing self-intersection so I planned to listen for the user creating each point after which I'd run a detection algorithm to check if the current polyline/linestring is self intersecting.
Unfortunately the only events in the documentation are the overlaycomplete events.
I could wait until the user has finished drawing their polygon before validating it and telling them it's not allowed, but it would be a much better experience if I could stop them from ever placing the point in the first place, potentially saving them a lot of wasted time and effort.
I could build my own drawing tool with the functionality I need, but the creation and maintenance of such a thing is something I'd rather avoid when Google have an offering that's so very close to what I need.
I already have the validation code ready to go, I'm using the JSTS code provided by similar questions here on SO, it's the Drawing Manager functionality that I'm asking about.