Removing a Google maps Circle/shape

后端 未结 4 2014
长情又很酷
长情又很酷 2021-02-03 21:40

I am creating a Circle using the google.maps.Circle() method. This all works fine and dandy, but how can I remove said circle?

My code:

var populationOpt         


        
4条回答
  •  忘掉有多难
    2021-02-03 22:39

    To remove a circle from the map, call the setMap() method passing null as the argument.

    circle.setMap(null);
    

    Note that the above method does not delete the circle. It simply removes the circle from the map. If instead you wish to delete the circle, you should remove it from the map, and then set the circle itself to null.

    https://developers.google.com/maps/documentation/javascript/shapes#circle_remove

提交回复
热议问题