It's a lot easier if you think in pixels instead of lat/lon, then you
don't need to worry about zoom levels.
For example:
// Global variables
bufferSize = 256; //pixels
centerBeforeMove = map.getCenter();
//and then, in the moveend event handler:
var proj = map.getCurrentMapType().getProjection();
var zoom = map.getZoom();
var centerAfterMove = map.getCenter();
var beforePx = proj.fromLatLngToPixel(centerBeforeMove, zoom);
var afterPx = proj.fromLatLngToPixel(centerAfterMove, zoom);
var d = Math.sqrt(Math.pow((beforePx.x - afterPx.x),2) + Math.pow
((beforePx.y - afterPx.y),2));
if (d < bufferSize) {
return;
}
//If you do search then update the last center value
centerBeforeMove = centerAfterMove;
//Call your search function here
--
Marcelo - http://maps.forum.nu
--
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---