From 7a0c47e8203f300d193e2291848526f9d63c5a8e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 15 Jul 2017 19:08:58 +1200 Subject: Fix more event selection issues --- web/app/view/EventsController.js | 14 ++++++++------ web/app/view/map/MapMarkerController.js | 5 ++++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'web') diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index d275c2c..f2fef88 100644 --- a/web/app/view/EventsController.js +++ b/web/app/view/EventsController.js @@ -84,13 +84,15 @@ Ext.define('Traccar.view.EventsController', { }, onSelectionChange: function (selection, selected) { - var event, position; + var event, positionId; event = selected.length > 0 ? selected[0] : null; - if (event && event.get('positionId')) { - position = Ext.getStore('EventPositions').getById(event.get('positionId')); - this.fireEvent('selectevent', position); - } else { - this.fireEvent('selectevent'); + if (event) { + positionId = event.get('positionId'); + if (positionId) { + this.fireEvent('selectevent', Ext.getStore('EventPositions').getById(positionId)); + } else { + this.fireEvent('selectevent'); + } } this.lookupReference('removeEventButton').setDisabled(!event); } diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index aa5be0f..951a825 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -454,7 +454,9 @@ Ext.define('Traccar.view.map.MapMarkerController', { if (this.selectedMarker) { if (this.selectedMarker.get('event')) { this.getView().getMarkersSource().removeFeature(this.selectedMarker); - this.fireEvent('deselectevent'); + if (!marker || !marker.get('event')) { + this.fireEvent('deselectevent'); + } } else if (!Ext.getStore('ReportRoute').showMarkers && this.selectedMarker.get('record') instanceof Traccar.model.Position) { this.getView().getMarkersSource().removeFeature(this.selectedMarker); @@ -495,6 +497,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, selectEvent: function (position) { + this.fireEvent('deselectfeature'); if (position) { var maker = this.addReportMarker(position); maker.set('event', true); -- cgit v1.2.3