diff options
author | Abyss777 <abyss@fox5.ru> | 2016-11-20 13:59:41 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-11-20 13:59:41 +0500 |
commit | f5c48588e2709e87e60703591e674ed9c5037077 (patch) | |
tree | ecb7ee23b9b5b8997fcf8bc5b5959fdeaa40836d /web/app/view/MapController.js | |
parent | 86e790c93f68016bcbf691adca8a0edfebb5fa38 (diff) | |
download | trackermap-web-f5c48588e2709e87e60703591e674ed9c5037077.tar.gz trackermap-web-f5c48588e2709e87e60703591e674ed9c5037077.tar.bz2 trackermap-web-f5c48588e2709e87e60703591e674ed9c5037077.zip |
Remove marker on device removing
Diffstat (limited to 'web/app/view/MapController.js')
-rw-r--r-- | web/app/view/MapController.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index ba72171d..9fcd4939 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -38,7 +38,8 @@ Ext.define('Traccar.view.MapController', { store: { '#Devices': { add: 'updateDevice', - update: 'updateDevice' + update: 'updateDevice', + remove: 'removeDevice' }, '#LatestPositions': { add: 'updateLatest', @@ -114,6 +115,19 @@ Ext.define('Traccar.view.MapController', { } }, + removeDevice: function (store, data) { + var i, deviceId; + if (!Ext.isArray(data)) { + data = [data]; + } + for (i = 0; i < data.length; i++) { + deviceId = data[i].get('id'); + if (this.latestMarkers[deviceId]) { + this.getView().getLatestSource().removeFeature(this.latestMarkers[deviceId]); + } + } + }, + onFollowClick: function (button, pressed) { if (pressed && this.selectedMarker) { this.getView().getMapView().setCenter(this.selectedMarker.getGeometry().getCoordinates()); |