This code might be of help
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.AttachEvent("onclick",MouseHandler);
map.AttachEvent("ondoubleclick",MouseHandler);
map.AttachEvent("onmousedown",MouseHandler);
map.AttachEvent("onmouseup",MouseHandler);
map.AttachEvent("onmousewheel",MouseHandler);
}
function MouseHandler(e)
{
if (e.eventName == "onclick")
{
if (e.leftMouseButton)
{
Do Something
}
else if (e.rightMouseButton)
{
Do Something
}
else if (e.leftMouseButton)
{
Do Something
}
}
}
Duncan Garratt wrote:
This code might be of help
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.AttachEvent("onclick",MouseHandler);
map.AttachEvent("ondoubleclick",MouseHandler);
map.AttachEvent("onmousedown",MouseHandler);
map.AttachEvent("onmouseup",MouseHandler);
map.AttachEvent("onmousewheel",MouseHandler);
}function MouseHandler(e)
{
if (e.eventName == "onclick")
{
if (e.leftMouseButton){
Do Something}
else if (e.rightMouseButton)
{
Do Something
}
else if (e.leftMouseButton){
Do Something
}
}}
Duncan Garratt wrote:
This code might be of help
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap();
map.AttachEvent("onclick",MouseHandler);
map.AttachEvent("ondoubleclick",MouseHandler);
map.AttachEvent("onmousedown",MouseHandler);
map.AttachEvent("onmouseup",MouseHandler);
map.AttachEvent("onmousewheel",MouseHandler);
}function MouseHandler(e)
{
if (e.eventName == "onclick")
{
if (e.leftMouseButton){
Do Something}
else if (e.rightMouseButton)
{
Do Something
}
else if (e.leftMouseButton){
Do Something
}
}}
This should do the job
var x = e.mapX;
var y = e.mapY;
var pixel = new VEPixel(x, y);
var latlong = map.PixelToLatLong(pixel);
var latitude = Math.round(10000*latlong.Latitude)/10000;
var longitude = Math.round(10000*latlong.Longitude)/10000;