Skip to content
Permalink
Browse files

Mobile: Animate recentering map to current position when tracking is …

…enabled
  • Loading branch information...
uprel committed Jun 5, 2019
1 parent e9c8455 commit b69d736b2265b0ee20164da03b422d228c771687
Showing with 3 additions and 2 deletions.
  1. +3 −2 client_mobile/src/map.js
@@ -892,13 +892,14 @@ Map.initialCenterOnLocation = function () {

Map.centerOnLocation = function() {
//we do not recenter every position update
var center = Map.map.getView().getCenter();
var view = Map.map.getView();
var center = view.getCenter();
var pos = Map.geolocation.getPosition();
var dx = Math.abs(center[0]-pos[0]);
var dy = Math.abs(center[1]-pos[1]);
var extent = Map.map.getView().calculateExtent();
if(dx > (ol.extent.getWidth(extent) / 4) || (dy > (ol.extent.getHeight(extent) / 4))) {
Map.map.getView().setCenter(pos);
view.animate({center: pos});
Map.clampToScale(Config.map.minScaleDenom.geolocation);
}
};

0 comments on commit b69d736

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