Skip to content

Commit c1fed4a

Browse files
committed
Add padding to map bounds after loading points
1 parent f963451 commit c1fed4a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/javascript/controllers/better_together/map_controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ export default class extends Controller {
8888
const popupContent = this.useLabelAsPopupValue ? label : popup_html
8989
const popup = marker.bindPopup(popupContent)
9090

91-
if (points.length == 1 && this.enablePopupsValue && popupContent) {
91+
if (points.length === 1 && this.enablePopupsValue && popupContent) {
9292
popup.openPopup() // Automatically open the popup
9393
}
9494

9595
return marker
9696
})
9797

9898
const bounds = L.latLngBounds(points.map(point => [point.lat, point.lng]))
99-
this.map.fitBounds(bounds)
99+
this.map.fitBounds(bounds, { padding: [50, 50] }) // Add padding to ensure points are visible
100100
}
101101
}

0 commit comments

Comments
 (0)