Skip to content

Commit

Permalink
Merge pull request #2562 from camptocamp/geoloc_untrack
Browse files Browse the repository at this point in the history
Fix geolocation untrack test
  • Loading branch information
fredj committed Apr 27, 2017
2 parents 772df22 + d0266af commit 195358b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/directives/mobilegeolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ ngeo.MobileGeolocationController.prototype.toggleTracking = function() {
return;
}
goog.asserts.assert(currentPosition !== undefined);
// stop tracking if the position is close to the center of the map.
var center = this.map_.getView().getCenter();
if (currentPosition[0] === center[0] &&
currentPosition[1] === center[1]) {
var diff = Math.abs(currentPosition[0] - center[0]) + Math.abs(currentPosition[1] - center[1]);
if (diff < 2) {
this.untrack_();
} else {
this.untrack_();
Expand Down

0 comments on commit 195358b

Please sign in to comment.