Right Click on marker - Google Maps V3

Viewed 15166

I've been trying to get a right click working on my markers but so far it seems that the event just isn't fired. As a workaround I'm currently detecting a right click on the map and then finding the nearest marker and triggering the right click method - obviously thats not great.

According to the docs, markers do have a right click event so I'm not sure what I'm doing wrong. https://developers.google.com/maps/documentation/javascript/reference#Marker

google.maps.event.addListener(marker, 'rightclick', handleRightClick)

doesn't work but

google.maps.event.addListener(map, 'rightclick', handleRightClick)

works fine. As does:

google.maps.event.addListener(marker, 'click', handleRightClick)

I'm also using a custom marker plugin called markerWithLabel - http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.1.9/docs/reference.html - I thought I'd cracked it when I discovered that this didn't add an event listener for the right click but even when I added one in myself, still no luck. I added this at line 257:

google.maps.event.addDomListener(this.eventDiv_, "rightclick", function(e) {
    if (me.marker_.getClickable()) {
        google.maps.event.trigger(me.marker_, "rightclick", e);
        cAbortEvent(e);
    }
})

Has anyone had similar issues or found better workarounds?

Thanks in advance.

3 Answers
Related