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

Fix google maps scrolling issue #2245

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion static/css/shared/_tiles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ $box-shadow-8dp: 0 8px 10px 1px rgba(0, 0, 0, .14), 0 3px 14px 2px rgba(0, 0, 0,
}
}

#map-container {
.map-container {
height: 100%;
min-height: 200px;
}
Expand Down
14 changes: 4 additions & 10 deletions static/js/components/google_map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,10 @@ function drawKmlCoordinates(
// Adjust map bounds
const sw = new google.maps.LatLng(mapInfo.down, mapInfo.left);
const ne = new google.maps.LatLng(mapInfo.up, mapInfo.right);
const bounds = new google.maps.LatLngBounds();
bounds.extend(sw);
bounds.extend(ne);

// add listener to set bounds after map finishes loading.
// fitting bounds needs to be called after map finishes loading
// otherwise, the map will zoom all the way out to earth.
map.addListener("idle", () => {
map.fitBounds(bounds, MAP_BOUNDS_PADDING);
});
let bounds = new google.maps.LatLngBounds();
bounds = bounds.extend(sw);
bounds = bounds.extend(ne);
map.fitBounds(bounds, MAP_BOUNDS_PADDING);

// Add polygons
if (mapInfo.coordinateSequenceSet) {
Expand Down