Google Maps Event - AddListener

0

Hello, I would like to know if anyone has any idea how to return a GLOBAL event from anything done on the map to be interpreted with CASE! Here's how I use them today.

  

google.maps.event.addListener (map, " click ", function (event) {

In case I did not want to define the CLICK example, but to analyze later, something like:

  

google.maps.event.addListener (map, function (event) {

Then, in CASE, I will analyze the event that came to deal with CASE and BREAK because I use 3 events on the map, and when the 3 are executed simultaneously it ends up getting 3 information on the map and it is overloading when it joins a lot of information.

If anyone knows of any method then I have tried everything and I still have not got it.

Thank you in advance.

    
asked by anonymous 28.01.2017 / 06:47

1 answer

0

After I said I was thinking of a better solution .. you can use the idea to clean / redraw but using timeout to reduce the number of redraw.

var EventoDisparado = false;

$(document).ready(function() {
  //código
  window.setTimeout("MuitasInformacoes", 1000);
});

function initMap(){
  //código
  google.maps.event.addListener(map, "evt_01", function(event) { 
    EventoDisparado = true;
  }); 
  google.maps.event.addListener(map, "evt_02", function(event) { 
    EventoDisparado = true;
  });
  google.maps.event.addListener(map, "evt_03", function(event) { 
    EventoDisparado = true;
  });
}

function MuitasInformacoes() {
  if (EventoDisparado) {
    //TODO: add as info
  }
  EventoDisparado = false;
}
    
28.01.2017 / 14:24