javascriptgoogle-mapsgoogle-maps-api-3directions

Google Maps V3 Directions Panel - a way to turn off step directions functionality?


Basically I want to turn off the feature that centers the map on each turn when you click on Directions Panel step.

Is there a way to disable that feature?

PS: i tried:

suppressMarkers: true,
suppressInfoWindows: true,

but those only take out the markers and infowindows - it still centers the map on the turn point when its clicked.


Solution

  • So this is what I ended up doing:

    function getDirections()
    {   
        var request = 
        {
            origin: start,
            destination: end,
            travelMode: google.maps.TravelMode.DRIVING
        };
    
        var summaryPanel = document.getElementById('directions_steps');
    
        directionsService.route(request, function(response, status) 
        {
            if (status == google.maps.DirectionsStatus.OK) 
            {
    
                directionsDisplay.setMap(map);
                directionsDisplay.setDirections(response);      
    
                var legs = response.routes[0].legs; 
    
                for (var leg = 0; leg < legs.length; leg++) {
                    for (var step = 0; step < legs[leg].steps.length;
                    step++) {
                        if (legs[leg].steps[step].lat_lngs) {                       
                            summaryPanel.innerHTML += legs[leg].steps[step].instructions+"<br/><br/>";                                                      
                        }
                    }
                }
    
            }
        });
    }