diff options
author | Abyss777 <abyss@fox5.ru> | 2017-03-15 10:55:49 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2017-03-15 10:55:49 +0500 |
commit | f9cbb295fcb677b7fc44f17afa22e50c3ef48a16 (patch) | |
tree | 0bf717a89190f619ab24ad09367d88fd3875ad37 /web/app/view/MapController.js | |
parent | b93d36f154d6e5b16769ddec07bb8936512f8bb1 (diff) | |
download | trackermap-web-f9cbb295fcb677b7fc44f17afa22e50c3ef48a16.tar.gz trackermap-web-f9cbb295fcb677b7fc44f17afa22e50c3ef48a16.tar.bz2 trackermap-web-f9cbb295fcb677b7fc44f17afa22e50c3ef48a16.zip |
Separate function for zooming to array of positions
Diffstat (limited to 'web/app/view/MapController.js')
-rw-r--r-- | web/app/view/MapController.js | 23 |
1 files changed, 1 insertions, 22 deletions
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index 1a2a9c13..57727f20 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -102,27 +102,6 @@ Ext.define('Traccar.view.MapController', { }, zoomToAllDevices: function () { - var data, i, point, minx, miny, maxx, maxy; - data = Ext.getStore('LatestPositions').getData(); - for (i = 0; i < data.items.length; i++) { - point = ol.proj.fromLonLat([ - data.items[i].get('longitude'), - data.items[i].get('latitude') - ]); - if (i === 0) { - minx = maxx = point[0]; - miny = maxy = point[1]; - } else { - minx = Math.min(point[0], minx); - miny = Math.min(point[1], miny); - maxx = Math.max(point[0], maxx); - maxy = Math.max(point[1], maxy); - } - } - if (minx !== maxx || miny !== maxy) { - this.getView().getMapView().fit([minx, miny, maxx, maxy]); - } else if (point) { - this.getView().getMapView().fit(new ol.geom.Point(point)); - } + this.zoomToAllPositions(Ext.getStore('LatestPositions').getData().items); } }); |