Skip to content

Commit

Permalink
set city on click
Browse files Browse the repository at this point in the history
  • Loading branch information
indraneel committed Mar 5, 2024
1 parent 52d154f commit fe5c148
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/src/components/MapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,13 @@ function MapComponent({
.filter(f => layerNames.includes(f.source));
if (features.length > 0) {
const feature = features[0];
if (feature.properties) {
setSelectedCity({
...feature.properties.msa_id,
if (e.lngLat && feature.properties) {
const setCity = {
msa_id: feature.properties.msa_id,
msa_name: feature.properties.msa_name,
center: [e.lngLat.lng, e.lngLat.lat]
})
} as CityRecord;
setSelectedCity(setCity)
map.current.flyTo({
center: [e.lngLat.lng, e.lngLat.lat],
zoom: 10.5
Expand Down

0 comments on commit fe5c148

Please sign in to comment.