Skip to content

Commit c60f32f

Browse files
committed
Address review comments
1 parent bb561d8 commit c60f32f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

projects/core/src/lib/components/edit/edit/edit.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class EditComponent implements OnInit {
104104
this.mapService.getMapViewDetails$() ]).pipe(
105105
takeUntilDestroyed(this.destroyRef),
106106
).subscribe(([ selectedEditLayerId, visibleLayers, mapViewDetails ]) => {
107-
const layers = selectedEditLayerId == null ? [] : visibleLayers.filter(layer =>
107+
const layers = selectedEditLayerId === null ? [] : visibleLayers.filter(layer =>
108108
layer.id !== selectedEditLayerId
109109
&& ScaleHelper.isInScale(mapViewDetails.scale, layer.minScale, layer.maxScale)
110110
&& this.selectedCopyLayerIds.length == 0 || this.selectedCopyLayerIds.includes(layer.id));
@@ -190,7 +190,7 @@ export class EditComponent implements OnInit {
190190
public createFeatureFromLayer(id: string) {
191191

192192
this.selectedCopyLayer$.pipe(take(1)).subscribe(selectedCopyLayer => {
193-
if (id == selectedCopyLayer) {
193+
if (id === selectedCopyLayer) {
194194
this.store$.dispatch(setEditCopyOtherLayerFeaturesDisabled());
195195
return;
196196
}

projects/core/src/lib/components/edit/state/edit.reducer.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,13 @@ const onLoadCopyFeaturesSuccess = (
8080
return state;
8181
}
8282

83-
// Deselect a feature by checking if the geometry WKT is already in the copiedFeatures array (can't search by fid)
83+
// Deselect a feature by checking if the geometry WKT is already in the copiedFeatures array.
84+
// We can't deselect by checking the FID, because WMS GetFeatureInfo responses have a different FID every time (generated by us), and we
85+
// want to have this work for WMS GFI responses as well.
8486
const sameGeometryIndex = state.copiedFeatures.findIndex(f => f.geometry === geometry);
8587
const copiedFeatures = sameGeometryIndex !== -1
86-
? state.copiedFeatures.filter((_, idx) => idx !== sameGeometryIndex)
88+
? [ ...state.copiedFeatures.slice(0, sameGeometryIndex), ...state.copiedFeatures.slice(sameGeometryIndex + 1) ]
8789
: [ ...state.copiedFeatures, payload.featureInfo[0].features[0] ];
88-
8990
return {
9091
...state,
9192
copiedFeatures,

0 commit comments

Comments
 (0)