我找不到从地图框方向隐藏/删除个人资料ui(交通,驾驶,步行,骑自行车)的选项。有没有可用的选择?
个人资料ui部分区域的截图。这是我需要隐藏的部分,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');
}
答案 0 :(得分:0)
您可以使用controls.profileSwitcher参数隐藏配置文件UI。几天前,mapbox团队添加了此选项。