How to make right menu(of maps.google.com) using google maps api v3?

2,190 views
Skip to first unread message

Sankar T

unread,
Dec 14, 2010, 3:40:50 AM12/14/10
to google-map...@googlegroups.com
Dear All,

Could anyone help me on how to create the default right click menu (of http://maps.google.com) with "directions from here", "directions to here", "Zoom in", etc... in our application using google maps api v3?

Thanks In Advance
Sankar T

Pil

unread,
Dec 14, 2010, 4:06:10 AM12/14/10
to Google Maps JavaScript API v3
You can translate this to v3

http://gmaps-utility-library-dev.googlecode.com/svn/tags/contextmenucontrol/1.0/

It's surely not done speedy and quick but it's doable.





On Dec 14, 9:40 am, Sankar T <sankar.ta...@gmail.com> wrote:
> Dear All,
>
> Could anyone help me on how to create the default right click menu (ofhttp://maps.google.com) with "directions from here", "directions to here",

pi5701

unread,
Dec 14, 2010, 5:58:46 AM12/14/10
to google-map...@googlegroups.com
i successfully managed to make a context menu taking this googlemaps v3 example as a start
http://gmaps-samples-v3.googlecode.com/svn/trunk/latlng-to-coord-control/latlng-to-coord-control.html

Pil

unread,
Dec 14, 2010, 6:12:18 AM12/14/10
to Google Maps JavaScript API v3


On Dec 14, 11:58 am, pi5701 <pistol...@chello.at> wrote:
> i successfully managed to make a context menu taking this googlemaps v3
> example as a starthttp://gmaps-samples-v3.googlecode.com/svn/trunk/latlng-to-coord-cont...


Hmm, I can't see any menu on right click ...

pi5701

unread,
Dec 14, 2010, 6:19:40 AM12/14/10
to google-map...@googlegroups.com
just bind the 'LatLng/Pixel Coordinate Custom Control' to google.maps.event.addListener(map, 'rightclick', function(mEvent) {};

pi5701

unread,
Dec 14, 2010, 6:32:40 AM12/14/10
to google-map...@googlegroups.com

Sankar Talam

unread,
Dec 14, 2010, 6:42:51 AM12/14/10
to google-map...@googlegroups.com
Dear Pi,

Thank you so much for the help. This is my perfect requirement.

--
Many Thanks
Sankar T


On Tue, Dec 14, 2010 at 5:32 AM, pi5701 <pist...@chello.at> wrote:

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.

CroNiX

unread,
Dec 14, 2010, 1:05:42 PM12/14/10
to Google Maps JavaScript API v3
Except in Firefox they disable the option to allow javascript to
create a contextmenu...by default...making contextmenus just about
useless.
So any user using FF won't see your menu unless they manually go and
allow that in the settings.

Options -> Content -> Allow Javascript (Advanced) -> Allow Scripts to:
[check] Disable or replace context menus

On Dec 14, 3:42 am, Sankar Talam <sankar.ta...@gmail.com> wrote:
> Dear Pi,
>
> Thank you so much for the help. This is my perfect requirement.
>
> --
> Many Thanks
> Sankar T
>
> On Tue, Dec 14, 2010 at 5:32 AM, pi5701 <pistol...@chello.at> wrote:
> > here you go:
> >http://www.mario-baldauf.org/test/contextmenu_v3.html
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Google Maps JavaScript API v3" group.
> > To post to this group, send email to
> > google-map...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2Bunsu...@googlegroups.com>
> > .

pi5701

unread,
Dec 15, 2010, 1:27:22 AM12/15/10
to google-map...@googlegroups.com
i can see the contextmenu in IE8, firefox3.6, chrome8 and opera10 without touching any of the browsers javascriptsettings.

Sankar T

unread,
Dec 15, 2010, 6:30:53 AM12/15/10
to google-map...@googlegroups.com
Even I can see the it in FireFox 3.0.5 too along with other browsers.
But only the strange thing is if I have multiple map objects Firefox is throwing error saying that 'map object is null'.

Cheers
Sankar T

Rossko

unread,
Dec 15, 2010, 7:17:02 AM12/15/10
to Google Maps JavaScript API v3
> But only the strange thing is if I have multiple map objects Firefox is
> throwing error saying that 'map object is null'.

What might your multiple map objects be called ... map1, map2 ?

Sankar Talam

unread,
Dec 15, 2010, 7:37:02 AM12/15/10
to google-map...@googlegroups.com
I am using TabContainer with 5 tabs & each tab will be loaded with google map for different oprations.
If I use single map object, whenever if I perform any operation in one tab the map will loaded with that perticular operation data in other tabs too, So am using different map objects (like initMap, poiMap, etc...which were similar to map1, map2...).
Some how this right click menu operations (Zoom in, Zoom out, Directions from here, etc...) are not detecting those map objects in Firefox but is working fine in IE8.(right now am performing the map operations on one map object and I will extend to others once if this works fine).

Regards
Sankar T

pi5701

unread,
Dec 16, 2010, 1:41:02 AM12/16/10
to google-map...@googlegroups.com
you hvae to change the global variable for map then.
try this for your initMap:
http://www.mario-baldauf.org/test/contextmenu_v3_initmap.html


Sankar Talam

unread,
Dec 16, 2010, 11:22:16 AM12/16/10
to google-map...@googlegroups.com
Pi,
I have declared all the map objects globally.
whenever if I go to any tab am initializing the map object for first time & 2nd time onwards am using that map object for the operations in that tab.

the link you pasted is not working. could you please check it once?

Thanks
Sankar T

sankar talam

unread,
Dec 16, 2010, 11:27:23 AM12/16/10
to Google Maps JavaScript API v3
Dear CroNiX,

Yes the context menus were not working in Firefox 3.6.13.

will there be any other way to overcome this issue without manually
changing the firefox settings?

Thanks
Sankar

Pil

unread,
Dec 16, 2010, 12:25:03 PM12/16/10
to Google Maps JavaScript API v3


On Dec 16, 5:27 pm, sankar talam <sankar.ta...@gmail.com> wrote:

> will there be any other way to overcome this issue without manually
> changing the firefox settings?


I don't think so. I'm sure that Google found a way at their official
maps page to bypass this settings if it would be possible.

The Firefox guys seems to have changed their policy in this regard. In
my eyes the new policy is right: It shouln'd be possible to change the
usual and default context menu when the user doesn't agree.
Reply all
Reply to author
Forward
0 new messages