forked from MapComplete/MapComplete
Further work on infobox, styling everything, removing clutter
This commit is contained in:
parent
2acd53d150
commit
0b4016b65d
48 changed files with 1283 additions and 454 deletions
|
@ -58,21 +58,36 @@ export class Basemap {
|
|||
|
||||
|
||||
constructor(leafletElementId: string, location: UIEventSource<{ zoom: number, lat: number, lon: number }>) {
|
||||
this. map = L.map(leafletElementId, {
|
||||
this.map = L.map(leafletElementId, {
|
||||
center: [location.data.lat, location.data.lon],
|
||||
zoom: location.data.zoom,
|
||||
layers: [this.osmLayer]
|
||||
layers: [this.osmLayer],
|
||||
attributionControl: false
|
||||
});
|
||||
|
||||
L.control.attribution({
|
||||
position: 'bottomleft'
|
||||
}).addTo(this.map);
|
||||
|
||||
this.Location = location;
|
||||
L.control.layers(this.baseLayers).addTo(this.map);
|
||||
const layerControl = L.control.layers(this.baseLayers, null,
|
||||
{
|
||||
position: 'bottomleft',
|
||||
hideSingleBase: true
|
||||
})
|
||||
layerControl.addTo(this.map);
|
||||
|
||||
this.map.zoomControl.setPosition("bottomleft");
|
||||
const self = this;
|
||||
|
||||
this.map.on("moveend", function () {
|
||||
location.data.zoom = self.map.getZoom();
|
||||
location.data.lat = self.map.getCenter().lat;
|
||||
location.data.lon = self.map.getCenter().lon;
|
||||
location.ping();
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue