Look at the source code for the ContextMenu example.
google.maps.event.addListener(map, 'rightclick', function(mouseEvent){
contextMenu.show(mouseEvent.latLng);
});
It's activated by a right click on the Map, a right click on a
Polyline is NOT detected.
Now look at the documentation for the Polyline:
https://developers.google.com/maps/documentation/javascript/reference#Polyline
Look under Events and you will see that a Polyline has a 'rightclick'
event just like the Map.
So you'll want to try something like this:
google.maps.event.addListener(MyPolyline, 'rightclick',
function(mouseEvent){
contextMenu.show(mouseEvent.latLng);
});
Where MyPolyline is a reference to the Polyline drawn by the
DirectionsRenderer.
Martin.
On Apr 11, 6:02 pm, Munna <[email protected]> wrote:
> Thank you for your help. But the context menu is not working on route,
> elsewhere working. Using this I can't replicate the google maps add
> destinations on/outside the selected route.
>
> Please helppppppppppppp
>
> On Mar 26, 2:09 pm, MymsMan <[email protected]> wrote:
>
>
>
>
>
>
>
> > I haven't tried it myself but this thread shows a sample right click
> > context
> > menuhttps://groups.google.com/d/topic/google-maps-js-api-v3/8mfN4FvZ4kk/d...
>
> > Bob
>
> > On Sunday, 25 March 2012 03:25:18 UTC+1, Munna wrote:
>
> > > Hi,
>
> > > I'm trying to write the code to add destination on selected route same
> > > as we do in google maps. When I create a route, I should able to add
> > > destination by right clicking on the path(created using
> > > directionService). Should able to add some additional information
> > > like wait time at that destination and all should be sent to database
> > > for future reference. Also there should be a option to add destination
> > > through input field as well.
>
> > > That means I want to replicate what you see on google maps home.
>
> > > Please provide the help/script. I'm looking for this solution on
> > > google for last 1 month. I've posted it on experts-exchange.com &
> > > stackoverflow.com but no luck. Please please please please please help
> > > me..
>
> > > Thank you.
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.