本文介绍了无法隐藏个人资料ui(交通,驾驶,步行,骑自行车)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到从地图框方向隐藏/删除个人资料ui(交通,驾驶,步行,骑自行车)的选项.有可用的选项吗?

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

个人资料ui部分区域的屏幕截图.这是我需要隐藏的部分,单击此处查看地图框方向的个人资料ui部分图片

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

我已经实现的代码,

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');

  }

推荐答案

您可以使用controls.profileSwitcher参数隐藏配置文件UI.该选项是几天前由Mapbox团队添加的.

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

这篇关于无法隐藏个人资料ui(交通,驾驶,步行,骑自行车)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-15 13:10