Closed GoogleCodeExporter closed 8 years ago
There is an event to do what you want: "zoomend"
http://code.google.com/apis/maps/documentation/events.html
http://code.google.com/apis/maps/documentation/reference.html#GMap2
A possible fix for your code (map is the GMap2 object containing your markers):
var gb = map.getBounds();
var zoomStarted = 0;
var zoomEnded = 0;
GEvent.addListener(map, "zoomend", function(oldLevel, newLevel) {
zoomEnded = 1;
});
while(!gb.containsLatLng(point)) {
if (!zoomStarted) {
zoomStarted = 1;
zoomEnded = 0;
map.zoomOut();
}
if (zoomEnded) {
zoomStarted = 0;
zoomEnded = 0;
gb = map.getBounds();
}
}
marker[i].setLatLng(point);
mgr.refresh();
Better yet would probably be to replace the while loop with something fancier
within the zoomend function to keep zooming out appropriately.
Original comment by lem...@gmail.com
on 31 Jul 2008 at 4:53
Original issue reported on code.google.com by
rouv...@gmail.com
on 10 Jul 2008 at 7:34