From 711ed97bba4231ab350a6f3efc0e9726827c068f Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Mon, 20 Nov 2023 11:51:31 -0800 Subject: [PATCH] Map: Pan to center of markers on load for UX --- mu-plugins/blocks/google-map/src/components/map.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mu-plugins/blocks/google-map/src/components/map.js b/mu-plugins/blocks/google-map/src/components/map.js index a216bb25a..923229c37 100644 --- a/mu-plugins/blocks/google-map/src/components/map.js +++ b/mu-plugins/blocks/google-map/src/components/map.js @@ -74,6 +74,12 @@ export default function Map( { apiKey, markers: rawMarkers, icon } ) { icon ); + panToCenter( + combinedMarkers.map( ( marker ) => marker.markerRef ), + googleMap.current, + googleMapsApi.current + ); + setLoaded( true ); }, [] );