Leaflet MarkerCluster LayerSupport:在移动浏览器上平移期间不会出现标记
Leaflet MarkerCluster LayerSupport: Markers do not appear during pan on mobile browsers
使用 Leaflet MarkerCluster LayerSupport 扩展,当从移动设备移动地图时,只有在释放拖动时标记才会消失并返回。
var mcgLayerSupportGroup = L.markerClusterGroup.layerSupport();
你可以在这里试试:
https://jsfiddle.net/DanyIdas/k08rbwu5/36/
要么
http://dwilhelm89.github.io/LeafletSlider
如 Leaflet.MarkerCluster.LayerSupport 子插件的自述文件所述:
Regular MCG options, events and methods
All regular MCG options, events and methods are available within MCG Layer Support. Refer to Leaflet.markercluster documentation.
特别是,您有 Leaflet.markercluster removeOutsideVisibleBounds
option:
removeOutsideVisibleBounds: Clusters and markers too far from the viewport are removed from the map for performance.
因此您可以只使用(在您的情况下禁用)该选项与 LayerSupport 子插件:
const mcgLayerSupportGroup = L.markerClusterGroup.layerSupport({
removeOutsideVisibleBounds: false // Disable default behaviour
});
已更新 JSFiddle:https://jsfiddle.net/sdunypa2/
注意:不需要创建常规的markerClusterGroup,只需要layerSupport就够了,如子插件quick guide.
使用 Leaflet MarkerCluster LayerSupport 扩展,当从移动设备移动地图时,只有在释放拖动时标记才会消失并返回。
var mcgLayerSupportGroup = L.markerClusterGroup.layerSupport();
你可以在这里试试:
https://jsfiddle.net/DanyIdas/k08rbwu5/36/ 要么 http://dwilhelm89.github.io/LeafletSlider
如 Leaflet.MarkerCluster.LayerSupport 子插件的自述文件所述:
Regular MCG options, events and methods
All regular MCG options, events and methods are available within MCG Layer Support. Refer to Leaflet.markercluster documentation.
特别是,您有 Leaflet.markercluster removeOutsideVisibleBounds
option:
removeOutsideVisibleBounds: Clusters and markers too far from the viewport are removed from the map for performance.
因此您可以只使用(在您的情况下禁用)该选项与 LayerSupport 子插件:
const mcgLayerSupportGroup = L.markerClusterGroup.layerSupport({
removeOutsideVisibleBounds: false // Disable default behaviour
});
已更新 JSFiddle:https://jsfiddle.net/sdunypa2/
注意:不需要创建常规的markerClusterGroup,只需要layerSupport就够了,如子插件quick guide.