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 10, 2024
1 parent 891d55f commit 083a425
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 @@ -134,39 +134,43 @@ const LeaftletMap = ({
>
<TileLayer {...TILE_LAYER_RD} />
<FeatureGroup ref={ref}>
<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 083a425

Please sign in to comment.