You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Carlo and I, working together on an application, have met a problem hard to
isolate and solve.
Markerclusterer library (of gmaps-utility-library-dev) has a bug.
Let me try to explain the problem.
Each cluster has an event associated with it (in fact, the click event
on the cluster triggers the "zoom in" on the map and the cluster
splits itself in markers or smaller clusters).
When, from the outside (for example, within a form), I clean the map -
map.clearOverlays(); - and then I refill it with a new search, I'm not
able anymore to destroy the clusters.
It seems the clusters are disappeared but, in fact, zooming in or out,
they come back.
Look at the three pictures in the post.
The first and the second picture shows the clusters correctly.
The third picture instead shows the clusters of the second
search AND the ones of the first (after having done
"zoom out").
The whole thing is due to a bug in the JavaScript garbage collection
(I suppose...).
The ojbect has been "subscribed" to an event. The object is destroyed
but after the first trigger of that event, the object come back.
To fix this strange bug (it's even hard to reproduce it, without a
form!) it's mandatory to provide to the markerclusterer library a
method to correctly destroy the clusters.
The patch (the diff file has been written again the 1159 revision)
adds the destroy method.
Before doing a new search, it is required to call
map.clearOverlays();
AND
markerCluster.destroy();
where markerCluster is your instance of MarkerClusterer(map, points);
The destroy() method calls:
this.clearMarkers();
GEvent.removeListener(mcfn_);
mcfn_ = null;
me_ = null;
I reported the bug to the developers with a demo of the bug itself
(and a second demo with the fix). I hope my patch could help people to
not get mad on it.
See here for the description of the bug:
http://maxb.net/blog/2010/03/15/markerclusterer-clearmarkers-bug-demo/
And here for test the bug and the fix
http://maxb.net/scripts/markerclusterer/bug.html
http://maxb.net/scripts/markerclusterer/fix.html
http://perassi.org/quickhacks/mkp/mk.diff
Thank you.
Original issue reported on code.google.com by [email protected] on 15 Mar 2010 at 2:01
The text was updated successfully, but these errors were encountered:
Original issue reported on code.google.com by
[email protected]
on 15 Mar 2010 at 2:01The text was updated successfully, but these errors were encountered: