Projet

Général

Profil

0001-maps-change-gps-button-behaviour-not-to-watch-positi.patch

Frédéric Péters, 27 juin 2018 14:44

Télécharger (2,09 ko)

Voir les différences:

Subject: [PATCH] maps: change gps button behaviour not to watch position
 continuously (#24810)

 combo/apps/maps/static/js/leaflet-gps.js | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
combo/apps/maps/static/js/leaflet-gps.js
49 49
	onAdd: function (map) {
50 50
		this._map = map;
51 51

  
52
		var container = L.DomUtil.create('div', 'leaflet-control-gps leaflet-bar');
52
		this._container = L.DomUtil.create('div', 'leaflet-control-gps leaflet-bar');
53 53

  
54
		this._button = L.DomUtil.create('a', 'gps-button', container);
54
		this._button = L.DomUtil.create('a', 'gps-button', this._container);
55 55
		this._button.href = '#';
56 56
		this._button.text = '\uf192';
57 57
		this._button.style.fontFamily = 'FontAwesome';
......
67 67
			.on('locationfound', this._drawGps, this)
68 68
			.on('locationerror', this._errorGps, this);
69 69

  
70
		return container;
70
		return this._container;
71 71
	},
72 72

  
73 73
	onRemove: function(map) {
......
75 75
	},
76 76

  
77 77
	_askGps: function() {
78
		this._firstMoved = false;
79
		this._container.classList.add('pending');
78 80
		this.activate();
79 81
	},
80 82

  
......
91 93
		this.addLayer();
92 94
		this._map.locate({
93 95
			enableHighAccuracy: true,
94
			watch: true,
95 96
			setView: false,
96 97
			maxZoom: null
97 98
		});
98 99
	},
99 100

  
100 101
	deactivate: function() {
102
		this._container.classList.remove('pending');
101 103
		this._isActive = false;
102 104
		this._firstMoved = false;
103 105
		this._map.stopLocate();
......
106 108
	},
107 109

  
108 110
	_drawGps: function(e) {
111
		this._container.classList.remove('pending');
109 112
		this._currentLocation = e.latlng;
110 113

  
111 114
		this._gpsMarker.setLatLng(this._currentLocation);
112
-