Angular-google-maps: How to recenter map based on marker position?

Created on 15 Dec 2016  路  4Comments  路  Source: SebastianM/angular-google-maps

* 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

important AgmMap feature-request

Most helpful comment

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.

All 4 comments

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.

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

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

How can this be fixed?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ssypi picture ssypi  路  27Comments

DoyeonOhTravelHow picture DoyeonOhTravelHow  路  31Comments

potham picture potham  路  54Comments

ramnes picture ramnes  路  54Comments

SteveDowsett picture SteveDowsett  路  23Comments