Skip to content

Commit c4b7140

Browse files
authored
fix: increase fitBounds padding to keep route markers inside viewport (#360)
1 parent 5d16f37 commit c4b7140

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/map/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,13 @@ export const MapComponent = () => {
446446
const dpOpen = state.directionsPanelOpen;
447447
const spOpen = state.settingsPanelOpen;
448448

449-
const paddingTopLeft = [screen.width < 550 ? 50 : dpOpen ? 420 : 50, 50];
449+
const paddingTopLeft = [
450+
window.innerWidth < 550 ? 80 : dpOpen ? 450 : 80,
451+
80,
452+
];
450453
const paddingBottomRight = [
451-
screen.width < 550 ? 50 : spOpen ? 420 : 50,
452-
50,
454+
window.innerWidth < 550 ? 80 : spOpen ? 450 : 80,
455+
80,
453456
];
454457

455458
mapRef.current.fitBounds(bounds, {

0 commit comments

Comments
 (0)