mapbox / mapbox/mapbox-gl-js

map.fitbounds giving wrong results when bearing is changed.

Open
#11,477 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

mapbox-gl-js version: 2.7.0 / all other versions

browser: Chrome/Safari

Steps to Trigger Behavior
View the jsfiddle (add your own accessToken):
https://jsfiddle.net/6fk7up9x/16

Expected Behavior
The markers should be visible at all times(when changing bearing), the map should fit the boundary box depending on the two coordinates that i provided and the provided bearing.

image

Actual Behavior
When changing bearing above 180 or under 100, the markers are not visible anymore.

image

Am i doing something wrong, or is there a bug in fitbounds?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked JSFiddle and reproduce the issue in map.fitBounds by changing the map bearing across the reported ranges. Compare the expected and actual marker visibility, then trace the fitBounds behavior from that entry point. Done means both provided coordinates remain visible at every tested bearing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.