I am trying to get the map to show using the Google geocoder widget when the field is at first hidden.

If I have access to the map object I can do something like this:

var map = Drupal.geolocation.maps[0].google_map, center = map.getCenter();
google.maps.event.trigger(map, 'resize');
map.setCenter(center);

I can't really see why the object couldn't be stored via the add_map function. See the following patch.

Comments

mikejw created an issue. See original summary.

mikejw’s picture

StatusFileSize
new381 bytes
mikejw’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: geolocation-add-map-object-2576203-2-8.patch, failed testing.

derjochenmeyer’s picture

Don't know why the tests fail with "The test did not complete due to a fatal error."

#2576271: tests fail with "The test did not complete due to a fatal error."

Status: Needs work » Needs review
derjochenmeyer’s picture

Great thanks for the patch. How would other users benefit from this?

mikejw’s picture

Well, it exposes up the object to javascript and allows you to programmatically modify the map after it has been added. You can use anything from the API. By doing this, it allows devs (eg. me) the ability to workaround edge cases (like refreshing hidden maps) without having to specifically put more cruft in the module, especially when these type of issues may only be transitory and might disappear in the future.

derjochenmeyer’s picture

Status: Needs review » Fixed

Great! Committed. Thank you mikejw!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.