If i understand you correctly then just disregard my comment "Where MyPolyline is a reference to the Polyline drawn by the DirectionsRenderer."
Just add the event listener to the straight polyline and it should work as desired. Martin. On May 17, 5:46 am, Munna <jaiswalsail...@gmail.com> wrote: > Thank You Martin for your valuable investigation. One concern, ask what I > tried/observed is polylines are straight lines connecting markers, but they > won't follow the road as direction service do. > > > > > > > > On Thursday, April 12, 2012 11:38:03 AM UTC+5:30, Martin™ wrote: > > > 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... > > > 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 <jaiswalsail...@gmail.com> 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 <bobbux...@gmail.com> 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 google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.