zoomIn, zoomOut, und centerHere implemen

This commit is contained in:
ISA
2024-04-15 11:01:22 +02:00
parent a051d47aab
commit df840396c4
12 changed files with 40 additions and 5 deletions

16
.gitignore vendored
View File

@@ -1 +1,15 @@
node_modules
# Node modules
/node_modules/
# .NET build output
/.next/
# Log files
*.log
# Environment variables
.env
# OS generated files
.DS_Store
Thumbs.db

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -153,7 +153,7 @@
/******/
/******/ /* webpack/runtime/getFullHash */
/******/ !function() {
/******/ __webpack_require__.h = function() { return "0f7a0a107ffd3df9"; }
/******/ __webpack_require__.h = function() { return "4146aa11c7c552df"; }
/******/ }();
/******/
/******/ /* webpack/runtime/global */

File diff suppressed because one or more lines are too long

View File

@@ -22,7 +22,14 @@ const MapComponent = () => {
initialMap.on("contextmenu", (event) => {
L.popup()
.setLatLng(event.latlng)
.setContent('<p><button onclick="zoomIn()">Zoom in</button></p>')
.setContent(
`
<p>
<button onclick="zoomIn()">Zoom in</button>
<button onclick="zoomOut()">Zoom out</button>
<button onclick="centerHere(${event.latlng.lat}, ${event.latlng.lng})">Hier zentrieren</button>
</p>`
)
.openOn(initialMap);
});
@@ -30,6 +37,14 @@ const MapComponent = () => {
initialMap.zoomIn();
};
window.zoomOut = () => {
initialMap.zoomOut();
};
window.centerHere = (lat, lng) => {
initialMap.panTo(new L.LatLng(lat, lng));
};
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',