aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-04-19 17:30:25 +0500
committerAbyss777 <abyss@fox5.ru>2017-04-19 17:30:25 +0500
commit8763594f66474464367af2b699bf70d840f31207 (patch)
treef8740ec2bf7730c73bc6f1ee1b4dc13fc2268c15
parent648d5fe1e4a0d92b79410572d386dac45b4e8d36 (diff)
downloadtrackermap-web-8763594f66474464367af2b699bf70d840f31207.tar.gz
trackermap-web-8763594f66474464367af2b699bf70d840f31207.tar.bz2
trackermap-web-8763594f66474464367af2b699bf70d840f31207.zip
Check feature existence before delete
-rw-r--r--web/app/view/map/MapMarkerController.js14
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);