Skip to content
Permalink
Browse files

Mobile: Don't show loading if tracking is enabled, smarter tracking m…

…ode (dont recenter map with every position update)
  • Loading branch information...
uprel committed Jun 5, 2019
1 parent 49e8084 commit e9c8455a99da6561ccf13f1a2bc41d83c3e7466b
Showing with 15 additions and 5 deletions.
  1. +15 −5 client_mobile/src/map.js
@@ -63,9 +63,11 @@ Progress.prototype.update = function() {
* Show the progress.
*/
Progress.prototype.show = function(par) {
//do not show it over layer panel
if( $("#panelLayer").hasClass("ui-panel-open") === false ) {
$.mobile.loading('show', {textVisible: true, text: par, theme: 'c'});
//do not show it over layer panel and don't show it if location and following are on
if($("#panelLayer").hasClass("ui-panel-open") === false) {
if(Map.geolocation===null || !Map.geolocation.getTracking() || !Gui.following) {
$.mobile.loading('show', {textVisible: true, text: par, theme: 'c'});
}
}
};

@@ -889,8 +891,16 @@ Map.initialCenterOnLocation = function () {
};

Map.centerOnLocation = function() {
Map.map.getView().setCenter(Map.geolocation.getPosition());
Map.clampToScale(Config.map.minScaleDenom.geolocation);
//we do not recenter every position update
var center = Map.map.getView().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);
Map.clampToScale(Config.map.minScaleDenom.geolocation);
}
};

Map.setWindowOrientation = function(orientation) {

0 comments on commit e9c8455

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