Skip to content
Permalink
Browse files

Fix initial center on location

  • Loading branch information...
uprel committed Jun 12, 2019
1 parent dcc15d7 commit 39e9152137b940899c60d4f6eba00c8d63d7e2b8
Showing with 10 additions and 3 deletions.
  1. +10 −3 client_mobile/src/map.js
@@ -873,12 +873,19 @@ Map.toggleFollowing = function(enabled) {
};

Map.initialCenterOnLocation = function () {
Map.centerOnLocation();

var pos = Map.geolocation.getPosition();
var view = Map.map.getView();

if (Config.map.initialGeolocationMaxScale != null) {
var maxRes = Map.scaleDenomToResolution(Config.map.initialGeolocationMaxScale, true);
if (Map.map.getView().getResolution() > maxRes) {
Map.map.getView().setResolution(maxRes);
view.animate({center: pos, resolution: maxRes});
} else {
view.animate({center: pos});
}
} else {
view.animate({center: pos});
}

if (typeof(Editor) == 'function') {
@@ -887,7 +894,7 @@ Map.initialCenterOnLocation = function () {
}
}
// disable after first update
//Map.geolocation.un('change:position', Map.initialCenterOnLocation);
Map.geolocation.un('change:position', Map.initialCenterOnLocation);
};

Map.centerOnLocation = function() {

0 comments on commit 39e9152

Please sign in to comment.
You can’t perform that action at this time.