配合D3使用Mapbox,padding麻烦

问题描述 投票:0回答:0

我在 react 中使用 Mapbox 和 D3 做天气

我使用 Mapbox fly 来包含像这样的填充

map.current.flyTo({
    center: bounds.getCenter(),
    zoom,
    essential: true,
    padding: { top: 200, bottom: 100, left: 50, right: 50 },
    duration: 2000,
});

使用后获取地图绑定大小

map.current.getBounds();

和d3这样画

enter image description here

我该如何解决?

删除填充并设置填充值包括d3

d3.js mapbox mapbox-gl-js
© www.soinside.com 2019 - 2024. All rights reserved.