Right click on OverlayView

338 views
Skip to first unread message

jbdemonte

unread,
Jun 27, 2011, 8:00:04 AM6/27/11
to Google Maps JavaScript API v3
Hi,

RightClick doesn't works on google.maps.OverlayView

You can test on : http://gmap3.net/issues/overlay-rightclick.htm

(this is a simple update of http://blog.mridey.com/2009/09/label-overlay-example-for-google-maps.html)

I added this :

google.maps.event.addDomListener(this.div_, 'click', function(e)
{
alert('click');
});
google.maps.event.addDomListener(this.div_, 'rightclick',
function(e) {
alert('rightclick');
});

Thanks,

DEMONTE Jean-Baptiste.

Pil

unread,
Jun 27, 2011, 12:09:56 PM6/27/11
to Google Maps JavaScript API v3
There is no regular event called 'rightclick'. That's an event
provided by the Maps API. The regular event is called 'click'. So the
'rightclick' event is only definable for map objects according to the
documentation.

Be that as it may, it looks like as if the Maps API makes it
impossible to register any right click on the map and on every DOM
element appended to the map. Seems you can't even use a regular event
listener provided by Javascript for that.




On Jun 27, 2:00 pm, jbdemonte <jbdemo...@gmail.com> wrote:
> Hi,
>
> RightClick doesn't works on google.maps.OverlayView
>
> You can test on :http://gmap3.net/issues/overlay-rightclick.htm
>
> (this is a simple update ofhttp://blog.mridey.com/2009/09/label-overlay-example-for-google-maps....)

Pil

unread,
Jun 28, 2011, 2:10:57 AM6/28/11
to Google Maps JavaScript API v3
Sorry, my last post wasn't entirely correct.
A regular right click isn't called 'click' but 'contextmenu'.

A contextmenu event can be registered on an OverlayView.

jean-baptiste demonte

unread,
Jun 28, 2011, 2:59:53 AM6/28/11
to google-map...@googlegroups.com
You're right, "contextmenu" works fine,

Thanks a lot.

JB
Reply all
Reply to author
Forward
0 new messages