commit 3cef5ec336251964af8b895913ceb2ca11ccfd86
parent 84dadd06a5b25fcdf930934d23ac80cf38204189
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sun, 26 Mar 2017 21:20:14 +0300
[coordinates] propper longitude on world map copies
Diffstat:
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/lib/leaflet.control.coordinates/index.js b/src/lib/leaflet.control.coordinates/index.js
@@ -18,6 +18,10 @@ function pad(s, n) {
return s;
}
+function mod(n, m) {
+ return ((n % m) + m) % m;
+}
+
L.Control.Coordinates = L.Control.extend({
options: {
position: 'bottomleft'
@@ -128,6 +132,7 @@ L.Control.Coordinates = L.Control.extend({
if (e) {
({lat, lng} = e.latlng);
}
+ lng = mod(lng + 180, 360) - 180;
this._field_lat.innerHTML = this.formatCoodinate(lat, true);
this._field_lon.innerHTML = this.formatCoodinate(lng, false);
},
diff --git a/src/lib/leaflet.control.search/index.js b/src/lib/leaflet.control.search/index.js
@@ -0,0 +1,14 @@
+import L from 'leaflet';
+import getGoogle from 'lib/googleMapsApi';
+
+
+function search(google) {
+ const attribution = L.DomUtil.create('div', '', document.body);
+ const places = new google.maps.places.PlacesService(attribution);
+ places.textSearch({query: 'Moscow'}, (result, status) => {
+ console.log({result, status});
+ debugger;
+ })
+}
+
+getGoogle().then(search);
+\ No newline at end of file