From f5c48588e2709e87e60703591e674ed9c5037077 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Sun, 20 Nov 2016 13:59:41 +0500 Subject: Remove marker on device removing --- web/app/view/MapController.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'web/app') 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()); -- cgit v1.2.3