Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recenter Map With Livewire #387

Open
DevTiago opened this issue Oct 26, 2022 · 3 comments
Open

Recenter Map With Livewire #387

DevTiago opened this issue Oct 26, 2022 · 3 comments

Comments

@DevTiago
Copy link

DevTiago commented Oct 26, 2022

Hi there,

Congratz for the package! Is working great, although i need to recenter with coordinates sent form the frontend.

I have a list of available coordinates, and when i click on one of them i fire a function that updates map coordinates.

I'll past the code from the controller:

 public $latitude = '0.0';
 public $longitude = '0.0';

public function centerMap($id)
    {
        $dg = DeliveryGuyDetail::find($id);

        $this->latitude = $dg->delivery_lat;
        $this->longitude = $dg->delivery_long;
    }


public function render()
    {

        Mapper::map($this->latitude, $this->longitude, ['zoom' => 18, 'async' => true, 'clusters' => ['size' => 20, 'center' => true], 'draggable' => true ]);

        return view('livewire.manager.delivery-map');
    }

i'm starting with the coordinates (0, 0) and updating them after the user click on the available coordinates and fire the function "centerMap". But when that happens the map disappear.

Any advice on that?

Thanks in advance.

@DevTiago DevTiago changed the title Re-center Map With Livewire Recenter Map With Livewire Oct 26, 2022
@michellaurent
Copy link
Contributor

I think you have to use the google panTo() function for that

@MohdSohail
Copy link

@DevTiago Did you find any resolution to this?

@DevTiago
Copy link
Author

No, not yet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants