Hi,
i am using method that will create context menu on right click any where on
the map my code is,
function createContextMenu(map)
{
contextmenu = document.createElement("div");
contextmenu.style.visibility="hidden";
contextmenu.style.background="#ffffff";
contextmenu.style.border="1px solid #8888FF";
contextmenu.innerHTML = '<a href="javascript:zoomIn()"><div
class="context"> Zoom in </div></a>'
+ '<a href="javascript:zoomOut()"><div
class="context"> Zoom out </div></a>'
+ '<a href="javascript:zoomInHere()"><div
class="context"> Zoom in here </div></a>'
+ '<a href="javascript:zoomOutHere()"><div
class="context"> Zoom out here </div></a>'
+ '<a href="javascript:centreMapHere()"><div
class="context"> Centre map here </div></a>';
map.getContainer().appendChild(contextmenu);
GEvent.addListener(map,"singlerightclick",function(pixel,tile)
{
//Pixel = map.fromLatLngToDivPixel(new
GLatLng(24.914463,67.0965958));
// var pixell =
map.getCurrentMapType().getProjection().fromLatLngToPixel(new
GLatLng(24.914463,67.0965958));
// clickedPixel = pixel;
var x=pixel.x;
var y=pixel.y;
// var x=24.914463;
// var y=67.0965958;
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";
});
GEvent.addListener(map, "click", function()
{
contextmenu.style.visibility="hidden";
});
}
I want to create context menu on right click but not any where on the map
but only at that place where i created "Markers" how would i do that i am
using
var x=pixel.x;
var y=pixel.y;
to create context menu any where on the map how would i restrict it to the
Markers only ??
Hopes for your suggestions
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-api/-/GclLyhGi8Q4J.
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.