diff options
author | Abyss777 <abyss@fox5.ru> | 2016-09-05 14:27:30 +0500 |
---|---|---|
committer | Abyss777 <abyss@fox5.ru> | 2016-09-05 14:27:30 +0500 |
commit | b7403aaadd130bf1496b97c07667842813d99550 (patch) | |
tree | 4a334be60e150b729fd8115e8227afb98cd8f8ff /web/app/view/MapController.js | |
parent | 6aca189651d8587b9178a38c1830a8cbd8ae0d46 (diff) | |
download | trackermap-server-b7403aaadd130bf1496b97c07667842813d99550.tar.gz trackermap-server-b7403aaadd130bf1496b97c07667842813d99550.tar.bz2 trackermap-server-b7403aaadd130bf1496b97c07667842813d99550.zip |
Implement retrieving map center from current map
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); } }); |