aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/MapMarkerController.js
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-12-01 12:00:19 +0500
committerAbyss777 <abyss@fox5.ru>2016-12-01 12:00:19 +0500
commitb53b223a07dbba48321d42204ffbb07a33ac2caf (patch)
treea567dce2fcc0fe49ebcf26792fb92588a425da4f /web/app/view/MapMarkerController.js
parent38b3a3e6df91b7c2135cfcca855826ce8f1b1e63 (diff)
downloadetbsa-traccar-web-b53b223a07dbba48321d42204ffbb07a33ac2caf.tar.gz
etbsa-traccar-web-b53b223a07dbba48321d42204ffbb07a33ac2caf.tar.bz2
etbsa-traccar-web-b53b223a07dbba48321d42204ffbb07a33ac2caf.zip
- Handle eventId url parameter
- Fit map view to events positions markers
Diffstat (limited to 'web/app/view/MapMarkerController.js')
-rw-r--r--web/app/view/MapMarkerController.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/web/app/view/MapMarkerController.js b/web/app/view/MapMarkerController.js
index 97e7592..9b699c0 100644
--- a/web/app/view/MapMarkerController.js
+++ b/web/app/view/MapMarkerController.js
@@ -225,7 +225,7 @@ Ext.define('Traccar.view.MapMarkerController', {
},
addReportMarkers: function (store, data) {
- var i, position, point, geometry, marker, style;
+ var i, position, point, geometry, marker, style, minx, miny, maxx, maxy;
this.clearReport();
for (i = 0; i < data.length; i++) {
position = data[i];
@@ -233,6 +233,10 @@ Ext.define('Traccar.view.MapMarkerController', {
position.get('longitude'),
position.get('latitude')
]);
+ minx = minx ? Math.min(point[0], minx) : point[0];
+ miny = miny ? Math.min(point[1], miny) : point[1];
+ maxx = maxx ? Math.max(point[0], maxx) : point[0];
+ maxy = maxy ? Math.max(point[1], maxy) : point[1];
geometry = new ol.geom.Point(point);
marker = new ol.Feature(geometry);
marker.set('record', position);
@@ -243,6 +247,15 @@ Ext.define('Traccar.view.MapMarkerController', {
this.reportMarkers[position.get('id')] = marker;
this.getView().getReportSource().addFeature(marker);
}
+ 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());
+ }
+ if (Traccar.app.hasEventId) {
+ this.fireEvent('selectreport', data[0], false);
+ Traccar.app.hasEventId = false;
+ }
},
clearReport: function () {