aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-12-29 16:31:11 +0500
committerAbyss777 <abyss@fox5.ru>2016-12-29 16:31:11 +0500
commitd9be85d9928a9c511335a3a2eb231dcfd1fb1d5a (patch)
tree990756691ce721cc865918b983c20a96ce4c5561
parent3362bc6315a7711b40649ee3a07fbfc8b0ff4ef8 (diff)
downloadetbsa-traccar-web-d9be85d9928a9c511335a3a2eb231dcfd1fb1d5a.tar.gz
etbsa-traccar-web-d9be85d9928a9c511335a3a2eb231dcfd1fb1d5a.tar.bz2
etbsa-traccar-web-d9be85d9928a9c511335a3a2eb231dcfd1fb1d5a.zip
Deselect markers
-rw-r--r--web/app/view/BaseMap.js13
-rw-r--r--web/app/view/DevicesController.js9
-rw-r--r--web/app/view/Map.js1
-rw-r--r--web/app/view/MapMarkerController.js8
-rw-r--r--web/app/view/ReportController.js9
-rw-r--r--web/app/view/StateController.js9
6 files changed, 41 insertions, 8 deletions
diff --git a/web/app/view/BaseMap.js b/web/app/view/BaseMap.js
index f0d51d5..d7309e7 100644
--- a/web/app/view/BaseMap.js
+++ b/web/app/view/BaseMap.js
@@ -120,9 +120,16 @@ Ext.define('Traccar.view.BaseMap', {
});
this.map.on('click', function (e) {
- this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) {
- this.fireEvent('selectfeature', feature);
- }.bind(this));
+ if (this.map.hasFeatureAtPixel(e.pixel, {
+ layerFilter: function (layer) {
+ return layer.get('name') !== 'geofencesLayer';
+ }})) {
+ this.map.forEachFeatureAtPixel(e.pixel, function (feature, layer) {
+ this.fireEvent('selectfeature', feature);
+ }.bind(this));
+ } else {
+ this.fireEvent('deselectfeature');
+ }
}, this);
},
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index f09950b..20b90b3 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -32,7 +32,8 @@ Ext.define('Traccar.view.DevicesController', {
listen: {
controller: {
'*': {
- selectreport: 'selectReport'
+ selectreport: 'selectReport',
+ deselectfeature: 'deselectFeature'
},
'map': {
selectdevice: 'selectDevice'
@@ -143,11 +144,15 @@ Ext.define('Traccar.view.DevicesController', {
selectReport: function (position) {
if (position !== undefined) {
- this.getView().getSelectionModel().deselectAll();
+ this.deselectFeature();
}
},
onUpdateDevice: function (store, data) {
this.updateButtons(this.getView().getSelectionModel());
+ },
+
+ deselectFeature: function () {
+ this.getView().getSelectionModel().deselectAll();
}
});
diff --git a/web/app/view/Map.js b/web/app/view/Map.js
index 2cc37ec..062bf4c 100644
--- a/web/app/view/Map.js
+++ b/web/app/view/Map.js
@@ -114,6 +114,7 @@ Ext.define('Traccar.view.Map', {
this.geofencesSource = new ol.source.Vector({});
this.map.addLayer(new ol.layer.Vector({
+ name: 'geofencesLayer',
source: this.geofencesSource
}));
diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js
index f8f0e43..e4e3979 100644
--- a/web/app/view/MapMarkerController.js
+++ b/web/app/view/MapMarkerController.js
@@ -52,7 +52,8 @@ Ext.define('Traccar.view.MapMarkerController', {
},
component: {
'#': {
- selectfeature: 'selectFeature'
+ selectfeature: 'selectFeature',
+ deselectfeature: 'deselectFeature'
}
}
}
@@ -379,5 +380,10 @@ Ext.define('Traccar.view.MapMarkerController', {
this.fireEvent('selectreport', record, false);
}
}
+ },
+
+ deselectFeature: function () {
+ this.selectMarker(null, false);
+ this.fireEvent('deselectfeature');
}
});
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 383b38b..0064c5b 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -33,7 +33,8 @@ Ext.define('Traccar.view.ReportController', {
controller: {
'*': {
selectdevice: 'selectDevice',
- showsingleevent: 'showSingleEvent'
+ showsingleevent: 'showSingleEvent',
+ deselectfeature: 'deselectFeature'
},
'map': {
selectreport: 'selectReport'
@@ -195,6 +196,12 @@ Ext.define('Traccar.view.ReportController', {
}
},
+ deselectFeature: function () {
+ if (this.lookupReference('reportTypeField').getValue() !== 'trips') {
+ this.getGrid().getSelectionModel().deselectAll();
+ }
+ },
+
selectTrip: function (trip) {
var from, to;
from = new Date(trip.get('startTime'));
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index 3835697..bef54d2 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -34,7 +34,8 @@ Ext.define('Traccar.view.StateController', {
'*': {
selectdevice: 'selectDevice',
selectreport: 'selectReport',
- updatealiases: 'updateAliases'
+ updatealiases: 'updateAliases',
+ deselectfeature: 'deselectFeature'
}
},
store: {
@@ -157,6 +158,12 @@ Ext.define('Traccar.view.StateController', {
}
},
+ deselectFeature: function () {
+ this.deviceId = null;
+ this.position = null;
+ Ext.getStore('Attributes').removeAll();
+ },
+
clearReport: function (store) {
this.position = null;
Ext.getStore('Attributes').removeAll();