I have referred to this issue already.
I can implement that also, but the problem is how will I identify if there is some change is the radius because DrawingManager
component will be unmounted.
Also I am unable to use function like setDrawingMode(null)
because it is not exposed in the react-google-maps public API's, also updating options
as drawingControl = false
is not working.
Is there any possible other solution through which we can restrict the user to create only one circle and also able to get radius_changed
somehow?
Below is the code
<GoogleMap
defaultZoom={8}
defaultCenter={new google.maps.LatLng(-34.397, 150.644)}
>
<DrawingManager
defaultDrawingMode={google.maps.drawing.OverlayType.CIRCLE}
defaultOptions={{
drawingControl: true,
drawingControlOptions: {
position: google.maps.ControlPosition.TOP_CENTER,
drawingModes: [
google.maps.drawing.OverlayType.CIRCLE,
],
},
circleOptions: {
fillColor: `#ffff00`,
fillOpacity: 1,
strokeWeight: 5,
clickable: false,
editable: true,
zIndex: 1,
},
}},
onOverlayComplete={(...args)=> /* what to do to disable drawing??*/}
/>
</GoogleMap>
Any help will be appreciated. Thanks.