Good day.
I draw a route using Google Maps JavaScript API. I include the route drawing like this:

directionsService.route({ origin: start, destination: finish, waypoints: waypoints, optimizeWaypoints: true, travelMode: google.maps.TravelMode.DRIVING }, function(response, status) { if (status === google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } else { window.alert('Проблема: ' + status); } }); 

With such a drawing route, the map is rewound and approaches so that the route is entirely on the screen. How to prevent this rewind?
Thank you in advance.

    1 answer 1

    DirectionsRendererOptions object specification preserveViewport

    Type this boolean. If this option is set to true, the viewport is left unchanged,

    In general, when creating directionsDisplay in the options you need to specify

     {preserveViewport: true}