Hi
I'm trying to drag a marker from outside the map-div, and then drop it
on the map. Things arent going to well.....
I use jquery UI drag/drop to do the draging, and the idea is to get
the "dropp-point" and create a marker there.
I seem to get wrong lat/lan after dropping the icon so the new created
marker will be placed wrong?
Please som help or ideas how to do this
Regards // johannes
var map;
var centerLat = 36.031332;
var centerLng = -23.203125;
var startZoom = 2;
var center = '';
var markerArray = new Array();
var cursorPointLat = '';
var cursorPointLng = '';
$(document).ready(function(){
map = new GMap2(document.getElementById("map"));
map.setCenter(new GLatLng(centerLat, centerLng), startZoom);
GEvent.addListener(map, "mousemove", function(pointer){
cursorPointLat = pointer.lat();
cursorPointLng = pointer.lng();
});
$("#draggable").draggable();
$("#map").droppable({
drop: function(event, ui) {
dropped();
}
});
function dropped(){
var customPoint = new GLatLng(cursorPointLat,cursorPointLng);
if (customPoint) {
var marker = new GMarker(customPoint, {draggable:true}
);
map.addOverlay(marker);
}
}
});
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---