Try
GEvent.addListener(map, "singlerightclick", function(pixel, src, ov) {
if (ov != null) alert ("you right clicked a marker");
});
As far as I know this is the only way to find out if a marker was
right clicked. You should also have a look at the reference.
On Jul 27, 4:18 pm, trez <[email protected]> wrote:
> Hi!!
> I'm going to develope a context menu.
> It'll be shown by a right mouse click and will permit to make some
> functions.
> I built it and works fine on the map, but the question is: can i catch
> a mark by this right click?
>
> More info:
> when left-click on the map, i create a mark adding this listener:
>
> GEvent.addListener(map, "click", function(marker, point) {
> if (marker) {
> marker.openInfoWindowHtml(marker.getLatLng().x+"<br>"+
> marker.getLatLng().y);} else {
>
> var marker = new GMarker(point);
> map.addOverlay(marker);
> marker.openInfoWindowHtml(point.x+"<br>"+ point.y);
> }
>
> });
>
> and now, i would the context menu allow me to interact with a mark:
> when i right-click on a mark, i could choose if edit or delete the
> mark thorugh the context menu, but how can i get that mark in my code?
> I have this code:
>
> GEvent.addListener(map,"singlerightclick",function(pixel,tile) {
> clickedPixel = pixel;
> var x=pixel.x;
> var y=pixel.y;
> if (x > map.getSize().width - 120) { x = map.getSize().width -
> 120 }
> if (y > map.getSize().height - 100) { y = map.getSize().height
> - 100 }
> var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize
> (x,y));
> pos.apply(contextmenu);
> contextmenu.style.visibility = "visible";
> });
>
> i think i could put "marker" instead "map", but i don't know how to
> get the marker :/
> Any idea?
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---