From 0814bc8b100b5165952c35d0ed374f69411107ee Mon Sep 17 00:00:00 2001 From: ztimson Date: Sun, 1 Sep 2019 15:46:20 -0400 Subject: [PATCH] Fixed deleting --- src/app/services/sync.service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/services/sync.service.ts b/src/app/services/sync.service.ts index cfcec4e..dcbdb73 100644 --- a/src/app/services/sync.service.ts +++ b/src/app/services/sync.service.ts @@ -72,8 +72,14 @@ export class SyncService { delete(...symbols) { let map = this.mapData.value; - [map.circles, map.markers, map.measurements, map.polygons, map.polylines, map.rectangles] - .forEach((storage: MapSymbol[]) => symbols.forEach(s => storage = (storage || []).filter(ss => !_.isEqual(s, ss)))); + symbols.forEach(s => { + if(map.circles) map.circles = map.circles.filter(r => !_.isEqual(s, r)); + if(map.markers) map.markers = map.markers.filter(r => !_.isEqual(s, r)); + if(map.measurements) map.measurements = map.measurements.filter(r => !_.isEqual(s, r)); + if(map.polygons) map.polygons = map.polygons.filter(r => !_.isEqual(s, r)); + if(map.polylines) map.polylines = map.polylines.filter(r => !_.isEqual(s, r)); + if(map.rectangles) map.rectangles = map.rectangles.filter(r => !_.isEqual(s, r)); + }); this.mapData.next(map); this.mapChanged = true; }