简体   繁体   中英

passing mouseevent to googlemaps event listener

At our company we use a self-developed web application (I helped to develop it). One part of that application loads day-specific data from a database (jobs to do that day), asks Google maps for the correct coordinates and shows each job on the map). Because those jobs can be clustered we use a custom tooltip, which pops up when we hoover a marker, to show some in-depth information about that job, without having to click on it.

This part did the trick for 4-5 years now (there are more events, but this is the only one that uses parameters in the triggered function):

google.maps.event.addListener(localOrderMarker,'mousemove',function(){hideToolTip();showToolTip(event,'some example text',200)});

But since the October 11 2015 update of the Google maps api v3 the first parameter of the "showToolTip" stays "undefined". Before that update the MouseEvent was passed, so we knew the exact location of the mouse-cursor but using the clientX and clientY properties. But now that does not work anymore :(

I am trying to find a solution. I did a lot of searching (almost 2 full working days now) and tried many things, but till now nothing worked.

Hopefully someone understands what's happening and can point me to a solution. Any help is appreciated.

this may be a possible workaround:

google.maps.event.addListener(localOrderMarker, 'mousemove', function(){
  google.maps.event.addDomListenerOnce(document, 'mousemove', function(event){
        hideToolTip();
        showToolTip(event,'some example text',200);
  });
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM