mapbox/mapbox-gl-js

map.fitBounds() with bearing does not fit the entire bounds

Open

#10,064 建立於 2020年11月1日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)JavaScript (2,203 fork)batch import
bug :lady_beetle:good first issue

倉庫指標

Star
 (10,532 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

When map.fitBounds(...) is called with a bearing option passed in, it seems like the bearing is not taken into the account on calculating the appropriate zoom, resulting in part of the bounded area to not be in view.

mapbox-gl-js version: 1.12.0

browser: Chrome

Steps to Trigger Behavior

  1. Create a bounded area with a list of coordinates
  2. Call map.fitBounds(...) with bearing option set

Link to Demonstration

https://jsfiddle.net/_blahblahblah/k4vL6s5r/

Expected Behavior

When clicking on the 'Fit to Line at 29º Bearing' button in the demo link, all 6 stations should be in view.

Actual Behavior

Only 4 of the 6 stations are in view.

貢獻者指南