aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-31 09:57:19 +1300
committerGitHub <noreply@github.com>2016-12-31 09:57:19 +1300
commita4b38c4e95fa5aa7533db945ea2f8200102a4ff4 (patch)
tree58b7be2c98bfc4b9e5eda068c1d5563fecd4922b /web/app
parent37001649c81ab0d9eb31b517fc0def473440fb21 (diff)
parent563f7b191379a26254541a0ffc4e20f23e7df3ec (diff)
downloadtrackermap-web-a4b38c4e95fa5aa7533db945ea2f8200102a4ff4.tar.gz
trackermap-web-a4b38c4e95fa5aa7533db945ea2f8200102a4ff4.tar.bz2
trackermap-web-a4b38c4e95fa5aa7533db945ea2f8200102a4ff4.zip
Merge pull request #379 from Abyss777/select_if_disabled
Highlight selected marker if they are disabled
Diffstat (limited to 'web/app')
-rw-r--r--web/app/view/MapMarkerController.js49
-rw-r--r--web/app/view/ReportConfigDialog.js2
2 files changed, 36 insertions, 15 deletions
diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js
index 0a87b5d3..b0147002 100644
--- a/web/app/view/MapMarkerController.js
+++ b/web/app/view/MapMarkerController.js
@@ -222,8 +222,22 @@ Ext.define('Traccar.view.MapMarkerController', {
}
},
+ addReportMarker: function (position) {
+ var geometry, marker, style, point = ol.proj.fromLonLat([
+ position.get('longitude'),
+ position.get('latitude')
+ ]);
+ geometry = new ol.geom.Point(point);
+ marker = new ol.Feature(geometry);
+ marker.set('record', position);
+ style = this.getReportMarker(position.get('deviceId'), position.get('course'));
+ marker.setStyle(style);
+ this.reportMarkers[position.get('id')] = marker;
+ this.getView().getMarkersSource().addFeature(marker);
+ },
+
addReportMarkers: function (store, data) {
- var i, position, point, geometry, marker, style, minx, miny, maxx, maxy;
+ var i, position, point, minx, miny, maxx, maxy;
this.clearReport();
for (i = 0; i < data.length; i++) {
position = data[i];
@@ -240,20 +254,14 @@ Ext.define('Traccar.view.MapMarkerController', {
maxx = Math.max(point[0], maxx);
maxy = Math.max(point[1], maxy);
}
- if (store.showMarkers !== false) {
- geometry = new ol.geom.Point(point);
- marker = new ol.Feature(geometry);
- marker.set('record', position);
- style = this.getReportMarker(position.get('deviceId'), position.get('course'));
- marker.setStyle(style);
- this.reportMarkers[position.get('id')] = marker;
- this.getView().getMarkersSource().addFeature(marker);
+ if (store.showMarkers) {
+ this.addReportMarker(position);
}
}
if (minx !== maxx || miny !== maxy) {
this.getView().getMapView().fit([minx, miny, maxx, maxy], this.getView().getMap().getSize());
- } else if (geometry) {
- this.getView().getMapView().fit(geometry, this.getView().getMap().getSize());
+ } else if (point) {
+ this.getView().getMapView().fit(new ol.geom.Point(point), this.getView().getMap().getSize());
}
},
@@ -275,6 +283,10 @@ Ext.define('Traccar.view.MapMarkerController', {
}
this.reportMarkers = {};
}
+
+ if (this.selectedMarker && this.selectedMarker.get('record') instanceof Traccar.model.Position) {
+ this.selectedMarker = null;
+ }
},
getRouteStyle: function (deviceId) {
@@ -346,9 +358,15 @@ Ext.define('Traccar.view.MapMarkerController', {
selectMarker: function (marker, center) {
if (this.selectedMarker) {
- this.resizeMarker(this.selectedMarker.getStyle(), false);
- this.selectedMarker.getStyle().setZIndex(0);
- this.selectedMarker.changed();
+ if (!Ext.getStore('ReportRoute').showMarkers &&
+ this.selectedMarker.get('record') instanceof Traccar.model.Position) {
+ this.getView().getMarkersSource().removeFeature(this.selectedMarker);
+ delete this.reportMarkers[this.selectedMarker.get('record').get('id')];
+ } else {
+ this.resizeMarker(this.selectedMarker.getStyle(), false);
+ this.selectedMarker.getStyle().setZIndex(0);
+ this.selectedMarker.changed();
+ }
}
if (marker) {
@@ -369,6 +387,9 @@ Ext.define('Traccar.view.MapMarkerController', {
selectReport: function (position, center) {
if (position instanceof Traccar.model.Position) {
+ if (!Ext.getStore('ReportRoute').showMarkers) {
+ this.addReportMarker(position);
+ }
this.selectMarker(this.reportMarkers[position.get('id')], center);
}
},
diff --git a/web/app/view/ReportConfigDialog.js b/web/app/view/ReportConfigDialog.js
index 8d42334b..421d0fe0 100644
--- a/web/app/view/ReportConfigDialog.js
+++ b/web/app/view/ReportConfigDialog.js
@@ -72,7 +72,7 @@ Ext.define('Traccar.view.ReportConfigDialog', {
reference: 'showMarkersField',
inputValue: true,
uncheckedValue: false,
- value: true
+ value: false
}, {
xtype: 'fieldcontainer',
layout: 'hbox',