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

map zoom changes when agp-direction is updated #88

Open
DanielEFGS opened this issue Jan 30, 2020 · 1 comment
Open

map zoom changes when agp-direction is updated #88

DanielEFGS opened this issue Jan 30, 2020 · 1 comment

Comments

@DanielEFGS
Copy link

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?

@explooosion explooosion added bug Indicates an unexpected problem or unintended behavior and removed bug Indicates an unexpected problem or unintended behavior labels Feb 7, 2020
@explooosion
Copy link
Owner

Hi @DanielEFGS !

See the documentation for the DirectionsRendererOptions - preserveViewport

For example:

<agm-direction
    ...
    [renderOptions]="renderOptions"
>
</agm-direction>
public renderOptions = {
    preserveViewport: true,
};

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

2 participants