From 7f4f5b460aad730f1a358f109b8ab5e6d49d65fc Mon Sep 17 00:00:00 2001 From: Aleksejs Popovs Date: Thu, 24 Nov 2022 14:27:41 -0500 Subject: [PATCH] Delete custom locate control --- umap/static/umap/js/umap.controls.js | 70 ---------------------------- umap/static/umap/map.css | 12 ----- 2 files changed, 82 deletions(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index cbb31dfe..b7b9bff7 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -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) { diff --git a/umap/static/umap/map.css b/umap/static/umap/map.css index 7f260131..707821c7 100644 --- a/umap/static/umap/map.css +++ b/umap/static/umap/map.css @@ -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 */ /* ****** */