aboutsummaryrefslogtreecommitdiff
path: root/web/app
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 /web/app
parent3362bc6315a7711b40649ee3a07fbfc8b0ff4ef8 (diff)
downloadtrackermap-web-d9be85d9928a9c511335a3a2eb231dcfd1fb1d5a.tar.gz
trackermap-web-d9be85d9928a9c511335a3a2eb231dcfd1fb1d5a.tar.bz2
trackermap-web-d9be85d9928a9c511335a3a2eb231dcfd1fb1d5a.zip
Deselect markers
Diffstat (limited to 'web/app')
-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 f0d51d52..d7309e76 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 f09950b3..20b90b3b 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 2cc37ecb..062bf4cb 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 f8f0e43f..e4e3979e 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 383b38bf..0064c5b8 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 38356979..bef54d27 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();