How can I change the location center of a map using Leaflet API?

前端 未结 4 1825
礼貌的吻别
礼貌的吻别 2021-02-04 21:11

My map (Mapbox) takes up the whole background of the site so the center is in the middle of the site. But the focus of the map for the user is on the right side because I have

4条回答
  •  我寻月下人不归
    2021-02-04 21:45

    Found this solution by ghybs over on GIS which helped me solve this problem:

    • Leaflet-active-area

      This plugin allows you to use a smaller portion of the map as an active area. All positioning methods (setView, fitBounds, setZoom) will be applied on this portion instead of the all map.

提交回复
热议问题