-
Notifications
You must be signed in to change notification settings - Fork 822
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
Bug: fitBounds counts old marker's positions #1512
Comments
I'm having the same issue: in particular, <agm-map [latitude]="lat" [longitude]="lng" [zoom]="zoom" [fitBounds]="fitBounds" [styles]="styles" id="map-place" (mapReady)="mapIsReady()">
<agm-marker *ngIf="myLocation!==undefined" [agmFitBounds]="true" [latitude]="myLocation.lat" [longitude]="myLocation.lng" [iconUrl]="'/assets/images/marker-mylocation.svg'" [markerClickable]="false"></agm-marker>
<agm-marker *ngFor="let m of markers; index as i" [agmFitBounds]="m.fitBounds" [latitude]="m.coords.lat" [longitude]="m.coords.lng" [iconUrl]="getIcon(i)" (markerClick)="markerClicked(i)" [markerClickable]="true"></agm-marker>
</agm-map> On landing I feed the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Dear Bot, I don't know whether @SebastianM did solve this, but I didn't see any new release coming in :) |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I am also receiving this error, is there any new developments on how we can fix this? |
I did it manually.
and then |
I have a workaround for this bug:
Just loop over an array of one element (source of marker data). As soon as the source will be changed old marker will be destroyed and a new one created. Probably not the best solution from the performance point of view, but works. |
when a FitBoundsAccessor emits new bounds, remove the old ones from the map's bounds array fixes: #1512
<agm-map (mapReady)="onMapReady($event)"> onMapReady(event) { const bounds: LatLngBounds = new google.maps.LatLngBounds(); |
When marker's position has been changed and it has [agmFitBounds]='true' directive, google.maps.LatLngBounds gets extended by new and old position. So agm-map is fitting both positions.
Steps to reproduce:
Current behavior:
Expected/desired behavior:
Versions:
Angular 6 & @agm/core: 1.0.0-beta.5
The text was updated successfully, but these errors were encountered: