🌍 Adjust map initialization logic for non-default routes

- Updated default latitude/longitude for routes other than `meetups.map`.
- Dynamically adjusted zoom level based on the current route name.
This commit is contained in:
HolgerHatGarKeineNode
2025-11-23 23:07:13 +01:00
parent a66a6a7207
commit 0a93b2b90b

View File

@@ -26,6 +26,10 @@ class extends Component {
->first(); ->first();
$this->latitude = $geoCountry->latitude ?? 51.165691; $this->latitude = $geoCountry->latitude ?? 51.165691;
$this->longitude = $geoCountry->longitude ?? 10.451526; $this->longitude = $geoCountry->longitude ?? 10.451526;
if ($this->currentRouteName !== 'meetups.map') {
$this->latitude = 20;
$this->longitude = 10;
}
} }
public function with(): array public function with(): array
@@ -115,7 +119,7 @@ class extends Component {
initializeMap() { initializeMap() {
const map = L.map($refs.map, { const map = L.map($refs.map, {
scrollWheelZoom: false scrollWheelZoom: false
}).setView([this.latitude, this.longitude], 6); }).setView([this.latitude, this.longitude], @js($currentRouteName === 'meetups.map' ? 6 : 3));
L.tileLayer('https://tile.openstreetmap.de/{z}/{x}/{y}.png', { L.tileLayer('https://tile.openstreetmap.de/{z}/{x}/{y}.png', {
minZoom: 0, minZoom: 0,