欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

地圖框API -移動方向框

榮姿康1年前9瀏覽0評論

我的地圖框方向應用程序接口工作正常。顯示A點到b點。方向/指示當前覆蓋在地圖上。我想顯示他們,但在地圖下的另一個div。有辦法做到這一點嗎?

enter image description here

<div class="flex-child-grow bg-white h-viewport-2/3 h-viewport-full-mm" id="map"></div>



   <script>

const  map = new mapboxgl.Map({ 
  container: 'map',
  style: 'mapbox://styles/mapbox/outdoors-v12',
  center: [-3.13256, 54.59947], // starting position [lng, lat]
zoom: 9 // starting zoom
});

const  directions = new MapboxDirections({
  accessToken: mapboxgl.accessToken,
  //unit: 'metric',
  profile: 'mapbox/walking',
  interactive: false,
  controls: {
    inputs: false,
    instructions: true,
    profileSwitcher: true,
      attributionControl: false
  }
});

map.addControl(directions);
map.on('load', () => {

  directions.setOrigin([startLat, startLng]);
  let bounds = new mapboxgl.LngLatBounds();
  bounds.extend([startLat, startLng]);
  bounds.extend([destLat, destLng]);
  directions.setDestination([destLat, destLng]);
  map.fitBounds(bounds, {padding: 900, duration: 3000});

});
</script>

這是你正在尋找的嗎?

<body>    
    <div id="map"></div>
    <div id = 'directions'></div>
  <script>
     const plugin = new MapboxDirections({
        accessToken: mapboxgl.accessToken,
        profile: "mapbox/walking"
      }); 
    
      //add direction plug in to an existing div 
        document.getElementById('directions').appendChild(plugin.onAdd(map))
  </script>
</body>