diff options
Diffstat (limited to 'web/app/view/MapController.js')
-rw-r--r-- | web/app/view/MapController.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index bc6a5d404..288593dab 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -23,7 +23,8 @@ Ext.define('Traccar.view.MapController', { controller: { '*': { selectDevice: 'selectDevice', - selectReport: 'selectReport' + selectReport: 'selectReport', + getMapCenter: 'getMapCenter' } }, store: { @@ -304,5 +305,13 @@ Ext.define('Traccar.view.MapController', { this.fireEvent('selectReport', record, false); } } + }, + + getMapCenter: function () { + var zoom, center, projection; + projection = this.getView().getMapView().getProjection(); + center = ol.proj.transform(this.getView().getMapView().getCenter(), projection, 'EPSG:4326'); + zoom = this.getView().getMapView().getZoom(); + this.fireEvent('setCenterFromMap', center[1], center[0], zoom); } }); |