Google Map Data Layer, click on the polygon and change the transparency (Chrome Bug)

I have a google map where I load geometry data * to data layer using addGeoJson. Everything works fine until I tried to bind the polygon event to change the opactiy parameters.

* I am removing city boundaries from OSM to draw polygons, I think my json object is well formatted, I used google as reference: https://storage.googleapis.com/mapsdevsite/json/google.json

As soon as I click on a polygon (any of them), it seems to duplicate my polygons anywhere, but the opacity changes correctly.

I used this as an example of my code: https://developers.google.com/maps/documentation/javascript/examples/layer-data-dynamic

Here is my JSFiddle: https://jsfiddle.net/fmarrot/k7b57egw/ (data can be seen in console.log (Config.polygon) (line 10)

Indeed, if I comment out lines 29 through 31, no problem at all, but I can no longer change the transparency of the polygon.

map.data.addListener('click', function(event) {
  event.feature.setProperty('opacity', (event.feature.getProperty('opacity')===0.5?0.9:0.5));
});

      

Any idea on what I am doing wrong?

Thank you for your help!

+2


source to share


1 answer


Ok I figured it was a Chrome bug (my version is 58.0.3029.110 (64-bit)), I just tested it with Firefox, Edge and IE with no problem> no duplicates per polygon click and works like a charm!

I will be waiting for the chrome fix or if anyone has a solution I would appreciate any suggestions!

UPDATE



As pointed out in Google Issue Tracker, the issue was fixed in Chrome 60. The related bug was reported Fixed on Aug 9, 2017.

https://buganizer.corp.google.com/issues/38211242

+1


source







All Articles