简体   繁体   English

三星Galaxy S4上的Markercluster不会删除缩放/单击时的标记

[英]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). 仅在Samsung Galaxy S4标准Internet浏览器(Android浏览器)上似乎会出现此问题。 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? 搜索过Google,但找不到任何有用的东西,有人可以解决此问题吗?

Edit: Image for reference. 编辑:图片供参考。

捕获 Edit2: Here's what I tried. Edit2:这是我尝试过的。

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);
       }
    }
});

I came across the same issue and found this: https://code.google.com/p/google-maps-utility-library-v3/issues/detail?id=309 . 我遇到了同样的问题,并发现了这个问题: 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: 对于我的情况起作用的是编辑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();
    });
};

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM