Agm-Direction
Agm-Direction copied to clipboard
map zoom changes when agp-direction is updated
i have the following code:
`<agm-map
[latitude]="lat"
[longitude]="lng"
[zoom]="zoom"
style="height: 100%; width: 100%;">
<agm-marker *ngFor="let d of markers"
(markerClick)="clickedMarker()"
[latitude]="d.lat"
[longitude]="d.lng"
[visible]="d.visible"
[iconUrl]="d.icon"
[animation]="d.animation">
</agm-marker>
<agm-direction
*ngFor="let dir of current_route"
[origin]="dir.origin"
[destination]="dir.destination"
travelMode="DRIVING"
[renderOptions]="renderOptions">
</agm-direction>
</agm-map>`
when adding a new address the map zoom increases by itself, despite having the fixed zoom at 18. How can i avoid this problem?
Hi @DanielEFGS !
See the documentation for the DirectionsRendererOptions - preserveViewport
For example:
<agm-direction
...
[renderOptions]="renderOptions"
>
</agm-direction>
public renderOptions = {
preserveViewport: true,
};