Delete custom locate control
This commit is contained in:
parent
864abf9f46
commit
7f4f5b460a
2 changed files with 0 additions and 82 deletions
|
@ -820,76 +820,6 @@ L.U.AttributionControl = L.Control.Attribution.extend({
|
|||
});
|
||||
|
||||
|
||||
L.U.LocateControl = L.Control.extend({
|
||||
|
||||
options: {
|
||||
position: 'topleft'
|
||||
},
|
||||
|
||||
onFound: function (e) {
|
||||
this._map._geolocated_circle.setRadius(e.accuracy);
|
||||
this._map._geolocated_circle.setLatLng(e.latlng);
|
||||
this._map._geolocated_marker.setLatLng(e.latlng);
|
||||
this._map.addLayer(this._map._geolocated_circle);
|
||||
this._map.addLayer(this._map._geolocated_marker);
|
||||
},
|
||||
|
||||
onError: function (e) {
|
||||
this.ui.alert({content: L._('Unable to locate you.'), 'level': 'error'});
|
||||
},
|
||||
|
||||
activate: function () {
|
||||
this._map.locate({
|
||||
setView: true,
|
||||
maxZoom: this._map.getZoom(),
|
||||
enableHighAccuracy: true,
|
||||
watch: true
|
||||
});
|
||||
this._active = true;
|
||||
},
|
||||
|
||||
deactivate: function () {
|
||||
this._map._geolocated_marker.removeFrom(this._map)
|
||||
this._map._geolocated_circle.removeFrom(this._map)
|
||||
this._map.stopLocate();
|
||||
this._active = false;
|
||||
},
|
||||
|
||||
toggle: function () {
|
||||
if (!this._active) this.activate();
|
||||
else this.deactivate();
|
||||
L.DomUtil.classIf(this._container, "active", this._active);
|
||||
},
|
||||
|
||||
onAdd: function (map) {
|
||||
var container = L.DomUtil.create('div', 'leaflet-control-locate umap-control'),
|
||||
link = L.DomUtil.create('a', '', container);
|
||||
link.href = '#';
|
||||
link.title = L._('Center map on your location');
|
||||
|
||||
map._geolocated_circle = L.circle(map.getCenter(), {
|
||||
radius: 10,
|
||||
weight: 0
|
||||
});
|
||||
|
||||
map._geolocated_marker = L.marker(map.getCenter(), {
|
||||
icon: L.divIcon({className: 'geolocated', iconAnchor: [8, 9]}),
|
||||
});
|
||||
|
||||
map.on("locationerror", this.onError, this);
|
||||
|
||||
map.on("locationfound", this.onFound, this);
|
||||
|
||||
L.DomEvent
|
||||
.on(link, 'click', L.DomEvent.stop)
|
||||
.on(link, 'click', this.toggle, this)
|
||||
.on(link, 'dblclick', L.DomEvent.stopPropagation);
|
||||
|
||||
return container;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
L.U.Search = L.PhotonSearch.extend({
|
||||
|
||||
initialize: function (map, input, options) {
|
||||
|
|
|
@ -1345,18 +1345,6 @@ a.add-datalayer:hover,
|
|||
line-height: 36px;
|
||||
}
|
||||
|
||||
/* *********** */
|
||||
/* Geolocation */
|
||||
/* *********** */
|
||||
.geolocated {
|
||||
width: 16px !important;
|
||||
height: 16px!important;
|
||||
background-color: #3388ff;
|
||||
border: 1px solid white;
|
||||
border-radius: 8px;
|
||||
box-shadow: 1px 5px 5px black;
|
||||
}
|
||||
|
||||
/* ****** */
|
||||
/* Mobile */
|
||||
/* ****** */
|
||||
|
|
Loading…
Reference in a new issue