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

How to recenter map based on marker position? #789

Closed
nthonymiller opened this issue Dec 15, 2016 · 4 comments
Closed

How to recenter map based on marker position? #789

nthonymiller opened this issue Dec 15, 2016 · 4 comments

Comments

@nthonymiller
Copy link

** Question **

I have implemented a fullscreen option for the map but when I go to the fullscreen and back I call triggerResize() on the map to update the bounds for the map.

However, when going to fullscreen or returning to normal size, the marker is no longer centered on the screen.

How could I trigger the map control to recenter for the given marker position.

angular2 & angular2-google-maps version
Angular: 2.12
Angular2-google-maps: 0.16.0

@sebholstein
Copy link
Owner

sebholstein commented Dec 15, 2016

This is not supported right now. Current workaround could be to change the latitude/longitude for 1 millisecond and then change back to the original position. That should trigger the centering.

I think it's a good idea to add it to the triggerResize method.

triggerResize(recenter = true) { ... }

This would be a breaking change but most people probably want that behavior.

@ngKisor
Copy link

ngKisor commented Mar 19, 2017

@amiller29au can i know how you use full screen map. i was wondering how to dot it.

sebholstein added a commit that referenced this issue Apr 12, 2017
When you call the triggerResize method of AgmMap, the map gets recentered
automaticaly.

Closes #789
Closes #976

BREAKING CHANGES

Recentering of the map after triggerResize call is now the default behavoir.
You can have the previous behavoir with triggerResize(false).
sebholstein added a commit that referenced this issue Apr 12, 2017
When you call the triggerResize method of AgmMap, the map gets recentered
automaticaly.

Closes #789
Closes #976

BREAKING CHANGES

Recentering of the map after a triggerResize call is now the default behavoir.
You can create the previous behavoir with triggerResize(false).
franknwankwo pushed a commit to caravancoop/angular2-google-maps that referenced this issue Jun 7, 2017
When you call the triggerResize method of AgmMap, the map gets recentered
automaticaly.

Closes sebholstein#789
Closes sebholstein#976

BREAKING CHANGES

Recentering of the map after a triggerResize call is now the default behavoir.
You can create the previous behavoir with triggerResize(false).
@Merott
Copy link

Merott commented Aug 13, 2017

Hello. Any plans to do a new release where this issue's fix is included?

@apryk
Copy link

apryk commented Dec 5, 2017

How can this be fixed?

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

No branches or pull requests

5 participants