Skip to content

Commit

Permalink
✨ [open-formulieren/open-forms#2177] Disabled logic
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen committed Dec 18, 2024
1 parent 8f533b3 commit eafa772
Showing 1 changed file with 35 additions and 31 deletions.
66 changes: 35 additions & 31 deletions src/components/Map/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,39 +135,43 @@ const LeaftletMap = ({
>
<TileLayer {...TILE_LAYER_RD} url={tileLayerUrl} />
<FeatureGroup ref={featureGroupRef}>
<EditControl
position="topright"
onCreated={onFeatureCreate}
edit={{
edit: false,
remove: false,
}}
draw={{
rectangle: false,
circle: !!interactions?.circle,
polyline: !!interactions?.polyline,
polygon: !!interactions?.polygon,
marker: !!interactions?.marker,
circlemarker: false,
}}
/>
{!disabled && (
<EditControl
position="topright"
onCreated={onFeatureCreate}
edit={{
edit: false,
remove: false,
}}
draw={{
rectangle: false,
circle: !!interactions?.circle,
polyline: !!interactions?.polyline,
polygon: !!interactions?.polygon,
marker: !!interactions?.marker,
circlemarker: false,
}}
/>
)}
</FeatureGroup>
{coordinates && <MapView coordinates={coordinates} />}
<SearchControl
onMarkerSet={onSearchMarkerSet}
options={{
showMarker: false,
showPopup: false,
retainZoomLevel: false,
animateZoom: true,
autoClose: false,
searchLabel: intl.formatMessage(searchControlMessages.searchLabel),
keepResult: true,
updateMap: true,
notFoundMessage: intl.formatMessage(searchControlMessages.notFound),
}}
/>
{/*{disabled ? <DisabledMapControls /> : <CaptureClick setMarker={onMarkerSet} />}*/}
{!disabled && (
<SearchControl
onMarkerSet={onSearchMarkerSet}
options={{
showMarker: false,
showPopup: false,
retainZoomLevel: false,
animateZoom: true,
autoClose: false,
searchLabel: intl.formatMessage(searchControlMessages.searchLabel),
keepResult: true,
updateMap: true,
notFoundMessage: intl.formatMessage(searchControlMessages.notFound),
}}
/>
)}
{disabled && <DisabledMapControls />}
</MapContainer>
{geoJsonCoordinates && geoJsonCoordinates.length && (
<NearestAddress coordinates={geoJsonCoordinates} />
Expand Down

0 comments on commit eafa772

Please sign in to comment.