How to sort points in a Google maps polygon so that lines do not cross?

后端 未结 3 436
庸人自扰
庸人自扰 2021-01-19 02:23

I am trying to make a map where a user can outline any shape they would like. But I am running into an issue where users can select points that will make the lines of the p

3条回答
  •  失恋的感觉
    2021-01-19 03:16

    I solved a similar problem in the past and ran into the issue that Jeffrey mentioned about not knowing exactly what shape the user is expecting. I ended up solving that issue by requiring the user to select the two points that they wanted the new point to be between. It requires more clicks (3 versus 1), but the user is entirely in control about what shape they want. I might still have the code that I used around somewhere (it was for Google Maps) if you're interested.

提交回复
热议问题