8 – How to recenter a geolocation google common map in views after an ajax boundary filter execution?


On Drupal 8.97 with all updated modules, I have a View that uses a Geolocation Google Common Map as an attachment. The map acts a boundary filter, but after the filter executes Drupal.ajax(ajaxSettings).execute() via /modules/contrib/geolocation/modules/geolocation_google_maps/js/geolocation-common-map-google.js, I am unable to re-center the map to ANY coordinates, including the user’s location.

Before the ajax call, map.getCenter() works, and so does manually inputting coordinates, like map.getCenter({ lat: -34.397, lng: 150.644 }), but afterwards, no dice. The custom re-center buttons I created still register clicks, and if console.log the map object afterwards, I can’t see any changes to the map object…and indeed some of my other custom map controls (like zoom in and out) still work after the ajax execution. I’m baffled.

I have looked at the ajaxSettings object too, and have attempted to change some of those center related properties before executing the Drupal.ajax(ajaxSettings).execute() command as above, but I still can’t get the map center to change (though I don’t quite know if I’m looking at the right properties…there’s hundreds of them). The map can still be panned around with a mouse of course, but I ultimately would like for users to be able to re-center to their location…and I would like to programmatically recenter and execute a search using the center of city locations without having to reload the page, so it’s kind of critical that I get this sorted.

Thank you in advance for your help.