我使用react-leaflet和'react-leaflet-draw'在地图上创建围栏。
我只想单击击剑网本身而不是单击编辑按钮来编辑击剑网。我正在使用geoJson创建击剑网,
任何人都可以告诉我有关允许在编辑模式下使用围栏的属性吗?
render() {
return (
<FeatureGroup>
<EditControl
position="bottomright"
edit={{ remove: false }}
draw={{
marker: false,
circle: false,
rectangle: false,
polygon: false,
polyline: false,
circlemarker: false,
}}
/>
{Object.values(this.props.geoFenceIdDataMapWithFlipCoordinates).
map(geoFence => (
<Polygon
key={geoFence.id}
color={`${geoFence.colorCode}`}
positions={geoFence.geoData.geoJSON.geometry.coordinates[0]}
/>
))}
</FeatureGroup>
);
}
}
答案 0 :(得分:0)
https://www.icampanile.com/reactjs/react-leaflet-and-google-map-layer-with-controls-draw/此URL将具有示例更新_onFeatureGroupReady
方法,
leafletGeoJSON.eachLayer((layer) => { leafletFG.addLayer(layer) layer?.editing?.enable()})