Open GoogleCodeExporter opened 8 years ago
Same issue on Mac/Safari + Firefox
Original comment by merul.pa...@gmail.com
on 9 Oct 2010 at 4:57
Are you still seeing a problem if you try the latest version?
Original comment by lu...@google.com
on 31 Mar 2011 at 6:03
[deleted comment]
[deleted comment]
It seems the following is happening:
1. When the maximum zoom level is reached, the map zoom_changed event is fired.
2. That results in cMarkerClusterer.resetViewport_(false) being called, which
removes all the markers/cluster icons from the map.
3. The map idle event is *not* called (since the zoom level has not changed,
since we are at the maximum zoom level), which results in markers/cluster icons
not being recreated.
I think the zoom_changed event shouldn't be fired in the first place.
The following workarrounds work for me, I'm not sure if it's the most clean way
to tackle the issue though:
// Add the map event listeners
var resetViewport = false;
this.listeners_ = [
google.maps.event.addListener(this.getMap(), "zoom_changed", function () {
resetViewport = true;
}),
google.maps.event.addListener(this.getMap(), "idle", function () {
if (resetViewport)
cMarkerClusterer.resetViewport_(false);
cMarkerClusterer.redraw_();
})
OR
var lastZoom = this.getMap().getZoom();
var redraw = false;
this.listeners_ = [
google.maps.event.addListener(this.getMap(), "zoom_changed", function () {
if (this.getZoom() != lastZoom) {
cMarkerClusterer.resetViewport_(false);
redraw = true;
lastZoom = this.getZoom();
}
}),
google.maps.event.addListener(this.getMap(), "idle", function () {
if (redraw) {
cMarkerClusterer.redraw_();
redraw = false;
}
})
Original comment by g...@superpointer.com
on 16 Aug 2011 at 2:09
Hi,
I had the same problem on one of my maps...
I solved it by using ">=" instead of ">"
Because, when we reach the maximum zoom, we need to display all the markers, we
can't cluster it anymore...
line 457 :
if (this.map_.getZoom() >= this.markerClusterer_.getMaxZoom())
Line 508
if (this.map_.getZoom() > this.markerClusterer_.getMaxZoom()) {
Also, i have another problem... When using an Hybrid map or a Satellite map..
Becase the real max zoom is not equal to the theorical one... in my case, the
theorical one is 22, and the real one is 19..
My problem is that the function to get the real zoom on hybrid or satellite map
is a asynchronous call to google servers.. and so, when my callback function is
called, i don't know anymore on wich cluster i asked (especially if i did
multiple requests..)
The fact is, my markers are so close that they could be separated only with a
big zoom... and the maximum zoom don't reach this level, so i need to display
them at the max zoom...
Hope the first part helps..
Hope the second one will find an answer...
Marc
Original comment by MarcPoly...@gmail.com
on 1 Sep 2011 at 6:52
I have this on v2.0.7 also. The problem is that The maps API throws a
zoom_changed every time you click a zoom control, even if it doesn't result in
the zoom changing (duh!). I've worked around it in a similar way to the above
by adding a currentZoom property and a check/return in the zoom_changed
listener.
Original comment by tim.poul...@gmail.com
on 26 Jan 2012 at 8:27
Original issue reported on code.google.com by
cyrils...@gmail.com
on 3 Jun 2010 at 10:41