diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-04-20 16:55:50 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-20 16:55:50 +1200 |
commit | 5d35a71af8642dc23cc230efc7d3fca8705efe13 (patch) | |
tree | f8740ec2bf7730c73bc6f1ee1b4dc13fc2268c15 /web/app | |
parent | 648d5fe1e4a0d92b79410572d386dac45b4e8d36 (diff) | |
parent | 8763594f66474464367af2b699bf70d840f31207 (diff) | |
download | trackermap-web-5d35a71af8642dc23cc230efc7d3fca8705efe13.tar.gz trackermap-web-5d35a71af8642dc23cc230efc7d3fca8705efe13.tar.bz2 trackermap-web-5d35a71af8642dc23cc230efc7d3fca8705efe13.zip |
Merge pull request #472 from Abyss777/fix_471
Check feature existence before delete while Device removing
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); |