- var visualizeLocation = function() {
- _log('visualizeLocation,' + 'setView:' + self._locateOnNextLocationFound);
+ var startFollowing = function() {
+ map.fire('startfollowing');
+ self._following = true;
+ if (self.options.stopFollowingOnDrag) {
+ map.on('dragstart', stopFollowing);
+ }
+ };
+
+ var stopFollowing = function() {
+ map.fire('stopfollowing');
+ self._following = false;
+ if (self.options.stopFollowingOnDrag) {
+ map.off('dragstart', stopFollowing);
+ }
+ visualizeLocation();
+ };
+
+ var isOutsideMapBounds = function () {
+ if (self._event === undefined)
+ return false;
+ return map.options.maxBounds &&
+ !map.options.maxBounds.contains(self._event.latlng);
+ };