Unable to hide profile ui (Traffic, Driving, Walking, Cycling)

末鹿安然 提交于 2019-12-11 06:34:29

问题


I do not find options to hide / remove profile ui(Traffic, Driving, Walking, Cycling) from the mapbox direction. Is there any options available?

screenshot of profile ui section area. This is the section, I need to hide,Click here to view the profile ui section pic of mapbox directions

The code that i have implemented,

enableMapboxDirection() {
    mapboxgl.accessToken = 'pk.eyJ1Ijoid2FsYWEtbWFwIiwiYSI6ImNqN2VuYmluZjBwZ2UzMnBqM20wNnJieWkifQ.2pKH-XbfOZuXzX9pEqGBjw';
    var directions = new MapboxDirections({
      accessToken: mapboxgl.accessToken,
      controls: {
        instructions: false,   
      },
      unit: 'metric', 
      profile: 'driving',  
    });
    var map = new mapboxgl.Map({
      container: 'map',
      style: 'mapbox://styles/mapbox/streets-v9'
    });
    map.on('load', function() {          
      directions.on('route', function(e) {
        console.log(e); // Logs the current route shown in the interface.
        console.log('Your Destination ',directions.getDestination());
        console.log('Your Origin ',directions.getOrigin());
      });
    });
    map.addControl(directions, 'top-left');

  }

回答1:


You can hide the profile UI with the controls.profileSwitcher parameter. This option is added by the mapbox team few days ago.



来源:https://stackoverflow.com/questions/46157474/unable-to-hide-profile-ui-traffic-driving-walking-cycling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!