Merge lp:~costales/unav/0.64-center-on-POI into lp:unav

Proposed by costales
Status: Merged
Merged at revision: 135
Proposed branch: lp:~costales/unav/0.64-center-on-POI
Merge into: lp:unav
Diff against target: 21 lines (+3/-1)
1 file modified
nav/class/UI.js (+3/-1)
To merge this branch: bzr merge lp:~costales/unav/0.64-center-on-POI
Reviewer Review Type Date Requested Status
uNav developers Pending
Review via email: mp+312983@code.launchpad.net

Description of the change

When search, adjust the map to the area, but keep the center always in the POI.
For example, Amsterdam is big, but the center is in the north and the POI keeps not center in the map.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nav/class/UI.js'
2--- nav/class/UI.js 2016-09-01 19:49:55 +0000
3+++ nav/class/UI.js 2016-12-11 09:45:14 +0000
4@@ -457,7 +457,6 @@
5 var zoom = ol.animation.zoom({duration: 600, resolution: map.getView().getResolution(), easing: ol.easing.linear});
6 this.map.beforeRender(pan, zoom);
7 if (pois.length === 1) {
8- this.map.getView().setCenter(ol.proj.transform([pois[0].lng, pois[0].lat], 'EPSG:4326', 'EPSG:3857'));
9 // Adjust zoom if so big
10 if (this.map.getView().getZoom() < 8)
11 this.map.getView().setZoom(8);
12@@ -468,6 +467,9 @@
13 extent_aux = ol.extent.applyTransform(extent_aux, ol.proj.getTransform("EPSG:4326", "EPSG:3857"));
14 this.map.getView().fit(extent_aux, this.map.getSize(), this.map.getSize(), {padding: [200, 15, 200, 15]});
15 }
16+ // Center on POI
17+ this.map.getView().setCenter(ol.proj.transform([pois[0].lng, pois[0].lat], 'EPSG:4326', 'EPSG:3857'));
18+
19 osm_type = 'none';
20 osm_id = 'none';
21 phone = 'none';

Subscribers

People subscribed via source and target branches