Skip to content

Commit c347f30

Browse files
authored
#2021: Enable zoom and pan of the Location map when read-only (#2025)
1 parent 5ff09be commit c347f30

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

geonode_mapstore_client/client/js/components/DetailsPanel/DetailsLocations.jsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ const getFeatureStyle = (type, isDrawn) => {
121121
};
122122
};
123123

124+
const defaultInteractions = {
125+
dragPan: true,
126+
mouseWheelZoom: true,
127+
pinchZoom: true
128+
};
129+
124130
const DetailsLocations = ({ onSetExtent, fields, allowEdit: allowEditProp, resource } = {}) => {
125131
const extent = get(fields, 'extent.coords');
126132
const initialExtent = get(fields, 'initialExtent.coords');
@@ -129,7 +135,7 @@ const DetailsLocations = ({ onSetExtent, fields, allowEdit: allowEditProp, resou
129135
const center = !isEmpty(extent) && polygon ? turfCenter(polygon) : null;
130136
const isDrawn = initialExtent !== undefined && !isEqual(initialExtent, extent);
131137

132-
const allowEdit = onSetExtent && !['map', 'dataset'].includes(resource?.resource_type) && allowEditProp;
138+
const allowEdit = !!(onSetExtent && !['map', 'dataset'].includes(resource?.resource_type) && allowEditProp);
133139

134140
return (
135141
<div className="gn-viewer-extent-map">
@@ -143,7 +149,14 @@ const DetailsLocations = ({ onSetExtent, fields, allowEdit: allowEditProp, resou
143149
registerHooks: false,
144150
projection: "EPSG:3857"
145151
}}
146-
options={{interactive: !!allowEdit}}
152+
options={{
153+
interactive: allowEdit,
154+
...(!allowEdit && {
155+
mapOptions: {
156+
interactions: defaultInteractions
157+
}
158+
})
159+
}}
147160
styleMap={{
148161
height: '100%'
149162
}}

0 commit comments

Comments
 (0)