Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
add maxzoom to map fit bounds
Browse files Browse the repository at this point in the history
Signed-off-by: Kerry Archibald <[email protected]>
  • Loading branch information
Kerry Archibald committed Apr 21, 2022
1 parent c70816d commit 73de15a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/views/location/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const useMapWithStyle = ({ id, centerGeoUri, onError, interactive, bounds }) =>
[bounds.west, bounds.south],
[bounds.east, bounds.north],
);
map.fitBounds(lngLatBounds, { padding: 100 });
map.fitBounds(lngLatBounds, { padding: 100, maxZoom: 15 });
} catch (error) {
logger.error('Invalid map bounds', error);
}
Expand Down
2 changes: 1 addition & 1 deletion test/components/views/location/Map-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('<Map />', () => {
const bounds = { north: 51, south: 50, east: 42, west: 41 };
getComponent({ bounds });
expect(mockMap.fitBounds).toHaveBeenCalledWith(new maplibregl.LngLatBounds([bounds.west, bounds.south],
[bounds.east, bounds.north]), { padding: 100 });
[bounds.east, bounds.north]), { padding: 100, maxZoom: 15 });
});

it('handles invalid bounds', () => {
Expand Down

0 comments on commit 73de15a

Please sign in to comment.