![](/img/trans.png)
[英]function zoom to cluster closes cluster with multiple markers at same lat/lng
[英]Leaflet Clustering markers with popups and zoom to pin closes the pin when at same lat lng
基本上我有带有聚集标记的传单。 在弹出窗口打开时,我缩放到标记,当在完全相同的位置有一个标记时,spiderify 消失并关闭弹出窗口。
map.on('popupopen', function(e) {
var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
var offsetPan;
var marker = e.popup._source;
marker.name = marker._tooltip._source._tooltip._content;
marker.unbindTooltip();
map.invalidateSize(true);
if(width <= 400){
offsetPan = [0, -250];
} else {
offsetPan = [0, -450];
}
map.flyToBounds([
marker._latlng
], {
paddingBottomRight: offsetPan
});
});
我放大到标记 [...] 蜘蛛消失并关闭弹出窗口。
这是 Leaflet.markercluster 插件的预期行为:每当地图缩放改变时,如果一个集群被蜘蛛化,蜘蛛化就会关闭,这会隐藏子标记,因此关闭它们的任何弹出窗口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.