Skip to content

Commit

Permalink
fix: set selected feature from search results #427
Browse files Browse the repository at this point in the history
  • Loading branch information
wazolab committed Nov 20, 2024
1 parent 1d3f4a7 commit 2009676
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions components/Home/Home.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { FitBoundsOptions, LngLatBounds } from 'maplibre-gl'
import type { FitBoundsOptions, LngLatBounds, MapGeoJSONFeature } from 'maplibre-gl'
import { storeToRefs } from 'pinia'
import type { MultiPolygon, Polygon } from 'geojson'
import { decodeBase32 } from 'geohashing'
Expand Down Expand Up @@ -43,7 +43,7 @@ const props = defineProps<{
// Composables
//
const mapStore = useMapStore()
const { center, isModeFavorites, isModeExplorer, isModeExplorerOrFavorites, mode, selectedFeature } = storeToRefs(mapStore)
const { center, isModeFavorites, isModeExplorer, isModeExplorerOrFavorites, mode, selectedFeature, teritorioCluster } = storeToRefs(mapStore)
const menuStore = useMenuStore()
const { apiMenuCategory, features, selectedCategoryIds } = storeToRefs(menuStore)
const favoriteStore = useFavoriteStore()
Expand Down Expand Up @@ -439,6 +439,8 @@ function toggleFavorite(feature: ApiPoi) {
function searchSelectFeature(feature: ApiPoi) {
mapStore.setSelectedFeature(feature)
goToSelectedFeature()
teritorioCluster.value?.setSelectedFeature(feature as unknown as MapGeoJSONFeature)
}
const bottomMenuRef = ref<HTMLDivElement>()
Expand Down
2 changes: 1 addition & 1 deletion components/MainMap/MapFeatures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export default defineNuxtComponent({
pinMarkerRenderFn: pinMarkerRender,
})
this.teritorioCluster.addEventListener('click', (e: Event) => this.updateSelectedFeature((e as CustomEvent).detail.selectedFeature))
this.teritorioCluster.addEventListener('feature-click', (e: Event) => this.updateSelectedFeature((e as CustomEvent).detail.selectedFeature))
this.map.on('click', this.onClick)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@sentry/vue": "^8.35.0",
"@tailwindcss/typography": "^0.5.9",
"@teritorio/map": "^0.12.7",
"@teritorio/maplibre-gl-teritorio-cluster": "^0.0.11",
"@teritorio/maplibre-gl-teritorio-cluster": "^0.0.12",
"@teritorio/openmaptiles-gl-language": "^1.5.4",
"@turf/boolean-intersects": "^6.5.0",
"@turf/mask": "^7.1.0",
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3985,14 +3985,14 @@ __metadata:
languageName: node
linkType: hard

"@teritorio/maplibre-gl-teritorio-cluster@npm:^0.0.11":
version: 0.0.11
resolution: "@teritorio/maplibre-gl-teritorio-cluster@npm:0.0.11"
"@teritorio/maplibre-gl-teritorio-cluster@npm:^0.0.12":
version: 0.0.12
resolution: "@teritorio/maplibre-gl-teritorio-cluster@npm:0.0.12"
dependencies:
"@turf/bbox": "npm:^7.1.0"
"@turf/helpers": "npm:^7.1.0"
maplibre-gl: "npm:^4.7.0"
checksum: 10c0/e4c9e0c5af4bb279ce324ad36c5be7d55dad2ee9b5af27e91c025dac156cd34c7ff984531726f9af5258cf592bbeef5128050755718ca8d10deb1cd90d136a8c
checksum: 10c0/f04440b42d9d5fa1374d512a29cef305f635e97dcfaec07c84e09facb885755c5bbce8c6ed2252e658bf58c7c38ff15fc552f9ac90296576b900ff7613cb0630
languageName: node
linkType: hard

Expand Down Expand Up @@ -4032,7 +4032,7 @@ __metadata:
"@tailwindcss/typography": "npm:^0.5.9"
"@teritorio/font-teritorio": "npm:^2.5.0"
"@teritorio/map": "npm:^0.12.7"
"@teritorio/maplibre-gl-teritorio-cluster": "npm:^0.0.11"
"@teritorio/maplibre-gl-teritorio-cluster": "npm:^0.0.12"
"@teritorio/openmaptiles-gl-language": "npm:^1.5.4"
"@turf/boolean-intersects": "npm:^6.5.0"
"@turf/mask": "npm:^7.1.0"
Expand Down

0 comments on commit 2009676

Please sign in to comment.