mapbox / mapbox/mapbox-gl-js

Fitbounds with center option not doing expected thing

Open
#11,337 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**:2.6.1

**browser**:Chrome

### Steps to Trigger Behavior

1.create LngLatBounds as `bounds`
2 .use `map.fitBounds` and pass the `center` option to it

### Link to Demonstration
check out this link for more info:
https://jsbin.com/zodotod/edit?html,output

### Expected Behavior
The `bounds` should be in the view and the `center` of the map should be the `center` option
### Actual Behavior
Just `flyTo` the center

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

Reproduce the behavior in Chrome using the JSBin demonstration with mapbox-gl-js 2.6.1, then start at the map.fitBounds entry point and trace how its center option is handled. Done means the bounds remain in view while the map center matches the supplied center option, with the behavior covered by an appropriate regression check if the repository provides one.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.