diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 75094a8..8e1ea4b 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -6469,4 +6469,4 @@ "integrity": "sha512-jEA1znR7b4C/NnaycInCU6h/d15ZzCd1jmsruqOKnZP6WXQSMH3W2GL+OXbkruslU4h+Tzuos0HdswzRUk/Vgg==" } } -} +} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 2112875..5ea8af9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -21,6 +21,7 @@ "leaflet-easybutton": "^2.4.0", "leaflet-iconmaterial": "^1.1.0", "papaparse": "^5.4.1", + "leaflet.markercluster": "^1.5.3", "pinia": "^2.1.6", "swagger-ui": "^5.10.5", "vee-validate": "^4.13.2", diff --git a/frontend/src/stores/map.js b/frontend/src/stores/map.js index f96b83a..ae06ae7 100644 --- a/frontend/src/stores/map.js +++ b/frontend/src/stores/map.js @@ -3,6 +3,7 @@ import { ref } from 'vue' import { ENDPOINTS } from '@/constants' import L from 'leaflet' import 'leaflet-iconmaterial/dist/leaflet.icon-material' +import 'leaflet.markercluster'; export const useMapStore = defineStore('map', () => { const leaflet = ref(null) @@ -11,6 +12,34 @@ export const useMapStore = defineStore('map', () => { const perceptualModelsGeojson = ref([]) const mapLoaded = ref(false) let currentFilteredData = ref([]) + const markerClusterGroup = L.markerClusterGroup({ + iconCreateFunction: (cluster) => { + const childCount = cluster.getChildCount(); + + let color = 'blue'; + if (childCount > 10) { + color = 'red'; + } + + return L.divIcon({ + html: ` +
${feature.properties.textmodel_snipped}
` } @@ -38,17 +67,17 @@ export const useMapStore = defineStore('map', () => { if(((props.textmodel_section_name && props.textmodel_section_name != "N/A") || (props.textmodel_section_number && props.textmodel_section_number != "N/A")) && (props.textmodel_page_number && props.textmodel_page_number != "N/A")){ - content += `Section ${props.textmodel_section_number != "N/A" ? (props.textmodel_section_number ) + ' ' : ''} ${props.textmodel_section_name != 'N/A' ? props.textmodel_section_name + ' ' : ''} ${props.textmodel_page_number != "N/A" ? ("(Page " + props.textmodel_page_number) + ')' : ''}
` } } else { if(props.citation.attribution == "Not open-access"){ - content += note + content += note + "figure" }else{ content += `` } if(props.figure_caption && props.figure_caption != "N/A"){ - content += `Figure ${props.figure_num != "N/A" ? (props.figure_num + ' : ') : ''} ${props.figure_caption}
` } } content += '