Skip to content

Commit

Permalink
fix: ensure all features are searched when computing map fit
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Nov 11, 2024
1 parent ba8d711 commit b429ae8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/MapView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,14 @@ async function baseFitMapToFeatures() {
// Wait for DOM updates to complete
await nextTick()
const features = map.querySourceFeatures('divisions', {
filter: ['in', ['get', 'DIVISION_NUM'], ['literal', highlightedDivisions.value]]
})
// Get the source data directly instead of using querySourceFeatures
const source = map.getSource('divisions')
if (!source || !source._data) return
const allFeatures = source._data.features
const features = allFeatures.filter(feature =>
highlightedDivisions.value.includes(feature.properties.DIVISION_NUM)
)
console.log('Found matching features:', features.length)
Expand All @@ -96,6 +101,8 @@ async function baseFitMapToFeatures() {
}
})
console.log('Bounds:', bounds)
// Get the search results bar height after DOM updates
const searchResults = document.querySelector('.search-results')
const searchResultsHeight = searchResults ? searchResults.offsetHeight : 0
Expand Down

0 comments on commit b429ae8

Please sign in to comment.