Folks,
I think I have a working application thanks to you guys.
Thanks so much.
My version of the send function is below. For quite a
while I couldn't make it work until I found some typos.
The most subtle typo was Submit=foo, not Server=foo.
function send() {
if (dog) { alert("You must select a point before clicking
Submit");
} else {
var templat = Math.round(theLatLng.lat()*100000)/100000 ;
var templng = Math.round(theLatLng.lng()*100000)/100000 ;
var url = "gmaps.php?Submit=foo&lat=" +templat+ "&lng=" +templng;
//GLog.write("About to send "+url+ " to the server");
GDownloadUrl(url,function(){});
}
}
There is still at least one bug that I could stomp out, but it is not
critical. If a person clicks a marker and then tries to drag it to
a new location, the original latlng is stored, not the ultimate one,
although the marker drags fine. I think this problem can be fixed
by moving or removing the GEvent.removeListener's() at the
end of the var mapClick shown below. Any ideas?
var mouseMove = GEvent.addListener(map, 'mousemove',
function(cursorPoint){
if(!noMore){
marker = new GMarker(cursorPoint,{draggable:true,
autoPan:false});
map.addOverlay(marker);
//marker.setImage(images[imageInd]);
noMore = true;
// This function deletes the marker when dragged outside map
GEvent.addListener(marker, 'drag', function(markerPoint){
if(!map.getBounds().containsLatLng(markerPoint)){
map.removeOverlay(marker);
}
});
}
if(dog){
marker.setLatLng(cursorPoint);
}
});
var mapClick = GEvent.addListener(map, 'click',
function(overlay,latlng){
dog = false;
theLatLng = latlng; // copy the location into a global
// 'mousemove' event listener is deleted to save resources
GEvent.removeListener(mouseMove);
GEvent.removeListener(mapClick);
});
Thanks, again for so much help.
Brian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---