我已經在所有fitbounds
教程Mapbox跑了,但還是無法弄清楚如何重新調整我的地圖給定的光柵層上。我有一個菜單,用於切換一些較舊的地圖,並且希望在每個轉彎處重新調整地圖。擬合的地圖範圍光柵層
這是我到目前爲止。 mapnumber
是我的柵格地圖的字符串。
var coordinates = map.getBounds(mapnumber);
var bounds = new mapboxgl.LngLatBounds(coordinates[0], coordinates[0]);
map.fitBounds({bounds});
的界限在那裏,我不能對他們使用fitbounds。這是錯誤。
lng_lat.js:97 Uncaught Error: `LngLatLike` argument must be specified
as a LngLat instance, an object {lng: <lng>, lat: <lat>}, or an array
of [<lng>, <lat>]
嘗試'map.fitBounds(邊界);'沒有括號{} – xmojmr
不,這也不行。 – east1999