From b429ae85054685a885caea90670b6fdd78e1bdfc Mon Sep 17 00:00:00 2001 From: Chris Alfano Date: Mon, 11 Nov 2024 00:16:10 -0500 Subject: [PATCH] fix: ensure all features are searched when computing map fit --- src/components/MapView.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/MapView.vue b/src/components/MapView.vue index f4a1065..dc66953 100644 --- a/src/components/MapView.vue +++ b/src/components/MapView.vue @@ -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) @@ -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