Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsoltMONOLITE authored Dec 3, 2023
1 parent 2f11a84 commit 8f46851
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ let map;
let panelID = "my-info-panel";

function init() {
// Create a new Leaflet map centered on the continental US
map = L.map("map").setView([51.5, -0.1], 14);

// This is the Carto Positron basemap
Expand All @@ -28,18 +27,6 @@ function init() {
}
).addTo(map);

let sidebar = L.control
.sidebar({
container: "sidebar",
closeButton: true,
position: "right",
})
.addTo(map);

map.on("click", function () {
sidebar.close(panelID);
});

// Use PapaParse to load data from Google Sheets
// And call the respective functions to add those to the map.
Papa.parse(geomURL, {
Expand Down Expand Up @@ -93,7 +80,7 @@ function addGeoms(data) {
var popup = L.popup()
.setLatLng(e.latlng)
.setContent(popupContent);
map.setView(e.latlng, map.getZoom() + 4);
map.setView(e.latlng, map.getZoom() + 2);

// Open the popup on the map
popup.openOn(map);
Expand Down Expand Up @@ -134,7 +121,6 @@ function addPoints(data) {
<p>Dropbox: ${data[row].dropbox}</p>
`);

// Sidebar feature for zooming
marker.on({
click: function (e) {
map.setView([data[row].lat, data[row].lon], 14);
Expand Down

0 comments on commit 8f46851

Please sign in to comment.