3

I am having an issue with layered markers in the Google Maps API when trying to open an InfoWindow on mouseover. I have created a sample fiddle using Google's Complex Items documentation example.

The beachflag marker is a complex shape and uses a 'poly' element to define the area for the mouseover. This allows the mouseover to only appear when the cursor is on the upper half of the img where the flag part actually is.

var map_marker = new google.maps.Marker({
    position: new google.maps.LatLng(-33.890542, 151.274856),
    map: map,
    shape: {
      coords: [1, 1, 1, 20, 18, 20, 18, 1],
      type: 'poly'
    },
    zIndex: 101,
    optimized: false,
    icon: "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"
});

The circle marker is situated behind the flag and is intended to be overlapped by the flag.

var map_marker = new google.maps.Marker({
    position: new google.maps.LatLng(-33.890542, 151.274856),
    map: map,
    zIndex: 100,
    optimized: false,
    icon: {
        path: google.maps.SymbolPath.CIRCLE,
        fillColor: "#0FF",
        fillOpacity: 1,
        strokeWeight: 1.5,
        scale: 40
    }
});

I have a mouseover event displaying an InfoWindow for both markers but the problem lies in the small area underneath the flag marker polygon, there is a void where the circle InfoWindow is expected to be show, but doesn't.

One possible resolution to this is to turn the circle marker into a straight Circle, however I need my circle to be a fixed size and not scale with my zoom level.

How can I see the lower-level marker through the upper-level marker's "empty space" outside of its defined poly shape, and correctly display the mouseover InfoWindow?

MrUpsidown
  • 21,592
  • 15
  • 77
  • 131
Cassius40k
  • 151
  • 4
  • Well... I don't think this is a *major* issue... but you can still [report it as a bug](https://code.google.com/p/gmaps-api-issues/issues/list?can=2&q=apitype:Javascript3%20type:Defect) and maybe Google will fix that at some point... Check in there if the issue was not already reported. – MrUpsidown May 11 '16 at 09:45
  • Good way to ask a question btw! – MrUpsidown May 11 '16 at 09:52
  • Have you tried this? http://stackoverflow.com/questions/8920738/google-maps-v3-marker-info-window-on-mouseover / http://stackoverflow.com/questions/13084631/google-maps-open-infowindow-on-mouseover-close-reopen-on-click – Android Enthusiast May 11 '16 at 10:20
  • @MrUpsidown If you saw my actual case and not the exaggerated fiddle you would say it is even less of an issue. I will be sure to check out the link. – Cassius40k May 11 '16 at 20:20

0 Answers0