这个问题似乎只发生在三星Galaxy S4标准互联网浏览器(Android浏览器)上。单击群集或使用控件放大时,第一个群集的图像将保留在地图上。
我已经尝试删除标记并再次将它们放回去,但收效甚微。搜索谷歌,但我找不到任何有用的东西,任何人都有解决这个问题的方法吗?
编辑图片供参考。
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);
}
}
});
答案 0 :(得分:1)
我遇到了同样的问题并发现了这个问题:https://code.google.com/p/google-maps-utility-library-v3/issues/detail?id=309。对我的情况有用的是编辑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();
});
};