diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/map/MapMarkerController.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 9dcb356c..44067dc6 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -157,15 +157,21 @@ Ext.define('Traccar.view.map.MapMarkerController', { for (i = 0; i < data.length; i++) { deviceId = data[i].get('id'); if (this.latestMarkers[deviceId]) { - this.getView().getMarkersSource().removeFeature(this.latestMarkers[deviceId]); + if (this.getView().getMarkersSource().getFeatureById(this.latestMarkers[deviceId].getId())) { + this.getView().getMarkersSource().removeFeature(this.latestMarkers[deviceId]); + } delete this.latestMarkers[deviceId]; } if (this.accuracyCircles[deviceId]) { - this.getView().getAccuracySource().removeFeature(this.accuracyCircles[deviceId]); + if (this.getView().getAccuracySource().getFeatureById(this.accuracyCircles[deviceId].getId())) { + this.getView().getAccuracySource().removeFeature(this.accuracyCircles[deviceId]); + } delete this.accuracyCircles[deviceId]; } if (this.liveRoutes[deviceId]) { - this.getView().getLiveRouteSource().removeFeature(this.liveRoutes[deviceId]); + if (this.getView().getLiveRouteSource().getFeatureById(this.liveRoutes[deviceId].getId())) { + this.getView().getLiveRouteSource().removeFeature(this.liveRoutes[deviceId]); + } delete this.liveRoutes[deviceId]; } } @@ -282,7 +288,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { ]) }); liveLine.setStyle(this.getRouteStyle(deviceId)); - liveLine.setId(position.get('deviceId')); + liveLine.setId(deviceId); this.liveRoutes[deviceId] = liveLine; if (this.isDeviceVisible(device)) { this.getView().getMarkersSource().addFeature(liveLine); |