在其他标记之上显示 Leaflet circleMarker?
Display Leaflet circleMarker on top of other markers?
我有一个 circleMarker
想要显示在所有其他标记之上。
marker documentation 列出选项 zIndexOffset
,但 circleMarker
没有此属性。
circleMarker
继承了 layer
的 pane
选项,所以我想我可以将标记窗格设置为 overlayPane
但这已经是默认设置了。 (参见 documentation)
我可以更改 overlayPane
的 z-index,但使用它的所有其他要素图层将共享相同的 z-index。
有没有一种简单的方法可以在其他 markers/layers 之上显示 circleMarker
?
我找到的解决方案是为圆形标记创建一个自定义窗格,然后在该窗格上设置 z-index:
map.createPane("locationMarker");
map.getPane("locationMarker").style.zIndex = 999;
locationMarker = L.circleMarker(e.latlng, { pane: "locationMarker" });
locationMarker.addTo(map);
我有一个 circleMarker
想要显示在所有其他标记之上。
marker documentation 列出选项 zIndexOffset
,但 circleMarker
没有此属性。
circleMarker
继承了 layer
的 pane
选项,所以我想我可以将标记窗格设置为 overlayPane
但这已经是默认设置了。 (参见 documentation)
我可以更改 overlayPane
的 z-index,但使用它的所有其他要素图层将共享相同的 z-index。
有没有一种简单的方法可以在其他 markers/layers 之上显示 circleMarker
?
我找到的解决方案是为圆形标记创建一个自定义窗格,然后在该窗格上设置 z-index:
map.createPane("locationMarker");
map.getPane("locationMarker").style.zIndex = 999;
locationMarker = L.circleMarker(e.latlng, { pane: "locationMarker" });
locationMarker.addTo(map);