diff --git a/frontend/src/components/TheLeafletMap.vue b/frontend/src/components/TheLeafletMap.vue index 47c0a57..e00d89c 100644 --- a/frontend/src/components/TheLeafletMap.vue +++ b/frontend/src/components/TheLeafletMap.vue @@ -59,6 +59,12 @@ onMounted(async () => { // query the api for the features await mapStore.fetchPerceptualModelsGeojson() + // Convert to Leaflet LatLngBounds + const bounds = L.latLngBounds(mapStore.allAvailableCoordinates); + + // Restrict panning to within bounds + leaflet.setMaxBounds(bounds); + // layer toggling let mixed = { "Perceptual Models": layerGroup, diff --git a/frontend/src/stores/map.js b/frontend/src/stores/map.js index ae06ae7..a05fea8 100644 --- a/frontend/src/stores/map.js +++ b/frontend/src/stores/map.js @@ -12,6 +12,7 @@ export const useMapStore = defineStore('map', () => { const perceptualModelsGeojson = ref([]) const mapLoaded = ref(false) let currentFilteredData = ref([]) + const allAvailableCoordinates = [] const markerClusterGroup = L.markerClusterGroup({ iconCreateFunction: (cluster) => { const childCount = cluster.getChildCount(); @@ -41,9 +42,8 @@ export const useMapStore = defineStore('map', () => { }, }); - function onEachFeature(feature, layer) { + function onEachFeature(feature, layer) { let content = `