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 19, 2024
1 parent 28ecbb0 commit 35c5271
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 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)

Check failure on line 443 in components/Home/Home.vue

View workflow job for this annotation

GitHub Actions / Cypress (ubuntu-latest, 20)

Property 'setSelectedFeature' does not exist on type '{ map: { style: { map: ...; stylesheet: { version: 8; name?: string | undefined; metadata?: unknown; center?: number[] | undefined; zoom?: number | undefined; bearing?: number | undefined; pitch?: number | undefined; ... 8 more ...; layers: ({ ...; } | ... 7 more ... | { ...; })[]; }; ... 108 more ...; setEventedPar...'. Did you mean 'resetSelectedFeature'?
}
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

0 comments on commit 35c5271

Please sign in to comment.