bradcornford / Googlmapper

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

Map disappers when changing livewire model #373

Closed dominik-eller closed 3 years ago

dominik-eller commented 3 years ago

Hi, i am including the map inside od a livewire component. Thats fine so far, but when I make changes to any livewire model (changing input oder radio) the map disappers. It is working with wire:ignore to the parents div of the map, but then i cannot interact with the map the way i like.

snggh commented 3 years ago

Hi, I also have the same problem.

bradcornford commented 3 years ago

Hi,

I've not used livewire components myself. However you may even need to call the initialise method yourself when the state changes:

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

arbendev commented 3 years ago

Hi, i am including the map inside od a livewire component. Thats fine so far, but when I make changes to any livewire model (changing input oder radio) the map disappers. It is working with wire:ignore to the parents div of the map, but then i cannot interact with the map the way i like.

Where you able to find a solution? having the same issue.

dominik-eller commented 3 years ago

Hi, i am including the map inside od a livewire component. Thats fine so far, but when I make changes to any livewire model (changing input oder radio) the map disappers. It is working with wire:ignore to the parents div of the map, but then i cannot interact with the map the way i like.

Where you able to find a solution? having the same issue.

I was not able to. Had a lot of work to do and so i could not test with it.

wrabit commented 3 years ago

In theory you should be able to incorporate $wire calls to your events (assuming that's how you are integrating with it) like so:

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventDragEnd' => '$wire.setSomething(event)']);
arbendev commented 3 years ago

In theory you should be able to incorporate $wire calls to your events (assuming that's how you are integrating with it) like so:

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventDragEnd' => '$wire.setSomething(event)']);

Hi,

Thank you for the reply... this is what I'm currently doing:

` public function render() {

    $venues = Venue::where('category_id', $this->category)->get();

    Mapper::map(40.75653332919923, -73.98020256160748, ['zoom' => 12, 'eventAfterLoad' => 'kmlLayers();', 'async' => true, 'clusters' => ['size' => 20, 'center' => true, 'zoom' => 14]]);

    foreach ($venues as $venue) {
        Mapper::marker($venue->latitude, $venue->longitude);
        Mapper::informationWindow($venue->latitude, $venue->longitude, '<a href="/concierge/summary/venue/'.$venue->slug.'">'.$venue->name.'</a>', ['open' => false, 'maxWidth'=> 350, 'autoClose' => true]);
    }

    return view('livewire.show-map', [
        'venues' => $venues
    ]);
}

`

Thanks!