bradcornford / Googlmapper

An easy way to integrate Google Maps with Laravel
MIT License
464 stars 143 forks source link

Map not rendering when parent element is hidden #372

Closed dominik-eller closed 3 years ago

dominik-eller commented 3 years ago

I am trying to render the map in a hidden livewire component. The div element only gets visible when clicking a button and then a simple livewire model changes state and the div is rendered. But the Map inside of that div is empty. Outside of that div everything works as expected.

bradcornford commented 3 years ago

Hi,

I think you need to use the async option.

Mapper::map(53.381128999999990000, -1.470085000000040000, ['async' => true]);

You may even need to call the initialise method yourself when the state changes:

google.maps.event.addDomListener(window, 'load', initialize_0);