Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map template: fit bounds when selecting category #438

Merged

Conversation

ammapspeople
Copy link
Contributor

What

Make the map fit to matching Locations when the user clicks/taps on a Category.

How

  • A new function was created in the Search component, fitMapBoundsToLocations. When called, it will build an array of GeoJSON features to be passed to the MapsIndoors JS SDK method goTo which will ensure that the map is fitted to encompass those Locations.
  • The onResults function in the the Search component was extended with an optional fitMapBounds parameter, which when set to true will call the new fitMapBoundsToLocations function.
  • This fitMapBounds parameter is set to true only when calling from the getFilteredLocations function, which is only run when the user clicks on a Category.
  • Also fixed a bug causing a media query match always to be false if called early. This caused the fitting to category locations when using the category prop to use the mobile padding on desktop sized screens since the value of isDesktop would be falsely false (😁) at that time.

Co-authored-by: Anders Mogensen <am@mapspeople.com>
@matbmapspeople
Copy link
Contributor

LGTM ✅

@Lucaci-Andrei
Copy link
Contributor

👍

Copy link
Contributor

@andreeaceachir142 andreeaceachir142 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗 🆗 🆗

@ammapspeople ammapspeople merged commit 3fdb925 into main Jan 16, 2025
@ammapspeople ammapspeople deleted the feature/map-template-fit-bounds-when-selecting-category branch January 16, 2025 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants