diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-20 23:31:04 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 23:31:04 +1300 |
commit | 6b0e967b5156071c3c0ad777af96a1c7e7ebc2de (patch) | |
tree | ecb7ee23b9b5b8997fcf8bc5b5959fdeaa40836d /web/app | |
parent | 86e790c93f68016bcbf691adca8a0edfebb5fa38 (diff) | |
parent | f5c48588e2709e87e60703591e674ed9c5037077 (diff) | |
download | trackermap-web-6b0e967b5156071c3c0ad777af96a1c7e7ebc2de.tar.gz trackermap-web-6b0e967b5156071c3c0ad777af96a1c7e7ebc2de.tar.bz2 trackermap-web-6b0e967b5156071c3c0ad777af96a1c7e7ebc2de.zip |
Merge pull request #331 from Abyss777/remove_device_marker
Remove marker on device removing
Diffstat (limited to 'web/app')
-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()); |