mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 912 forks source link

Map.clear not clearing circles or polyline #539

Closed thim81 closed 8 years ago

thim81 commented 9 years ago

Hi,

I have 2 view controllers using the map but when I'm using the map.clear(), the markers are cleared but the circles and polylines remain.

I use the following code to initiate the map per controller and in some controller I set a map and polyline and the other I set markers and a new polyline.

// Canvas
var mapcanvas = document.getElementById("mapcanvas");

// Create map
map = window.plugin.google.maps.Map.getMap();

// Event - Map ready
 map.on(plugin.google.maps.event.MAP_READY, function () {
 console.log('map is ready');

 // Clear the map first
 map.clear();
 map.refreshLayout(); // perhaps this is not necessary

 // Configure map and set to DIV
 map.setDiv(mapcanvas);
 map.setOptions({
     'controls': {
          'compass': true,
          'myLocationButton': false,
          'indoorPicker': false,
          'zoom': false
     }
});

not sure if i'm doing something wrong

hirbod commented 8 years ago

There is a new version out (please use the master). This should work fine! Just tested it without any problems.