Drag (move) a polygon using Google Maps v3

前端 未结 5 916
清歌不尽
清歌不尽 2021-01-02 15:49

The Google Maps API for a Polygon does not offer a drag method.

What would be an efficient way of implementing such a feature (i.e., sufficiently optimised so that i

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-02 16:23

    You could have markers for each point on the polygon, these markers could have drag and at the end of each drag, the polygon could be redrawn.

    You could also have a marker in the center of the polygon representing the polygon as a whole, when you move that marker, every marker could be moved by the same amount to maintain the shape.

提交回复
热议问题