Camathon
Camathon

Reputation: 524

Markercluster on Samsung galaxy s4 does not remove markers on zoom/click

This problem only seems to occur on Samsung Galaxy S4 standard Internet browser (Android browser). The image of the first cluster remains on the map when you either click a cluster or zoom in with the controls.

I've tried removing the markers and putting them back again but to little success. Searched Google, but I'm not finding anything useful, anybody have a solution to this problem?

Edit: Image for reference.

Captures Edit2: Here's what I tried.

google.maps.event.addListener(map, 'zoom_changed', function () {
     if (mapMarkers.length > 1) {
        for (var i = 0; i < mapMarkers.length; i++) {
            mapMarkers[i].setVisible(false);
            mapMarkers[i].setVisible(true);
        }
     }
});

google.maps.event.addListener(map, 'clusterclick', function () {
    if (mapMarkers.length > 1) {
        for (var i = 0; i < mapMarkers.length; i++) {
            mapMarkers[i].setVisible(false);
            mapMarkers[i].setVisible(true);
       }
    }
});

Upvotes: 0

Views: 160

Answers (1)

testpattern
testpattern

Reputation: 2498

I came across the same issue and found this: https://code.google.com/p/google-maps-utility-library-v3/issues/detail?id=309. What worked for my situation was editing the unminified version of markercluster.js:

/**
 * Adding the cluster icon to the dom.
 * @ignore
 */
ClusterIcon.prototype.onAdd = function () {

    this.div_ = document.createElement('DIV');
    if (this.visible_) {
        var pos = this.getPosFromLatLng_(this.center_);
        this.div_.style.cssText = this.createCss(pos);
        this.div_.innerHTML = this.sums_.text;
    } 
    // added this else statement
    else {
        this.hide();
    }

    var panes = this.getPanes();
    panes.overlayMouseTarget.appendChild(this.div_);

    var that = this;
    google.maps.event.addDomListener(this.div_, 'click', function () {
        that.triggerClusterClick();
    });
};

Upvotes: 1

Related Questions