mapbox / mapbox/mapbox-gl-js

transform not marked as unmodified when map initialised with center and zoom of 0

Open
#6,658 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**: 0.45.0

### Steps to Trigger Behavior

1. Use a style which sets a center/zoom
2. Initialise a map using that style setting the center and zoom to 0/0/0

### Link to Demonstration

http://jsbin.com/wudona/edit?html,output

### Expected Behavior

The map should be initialised to 0/0/0.

### Actual Behavior

The map is initialsed to the center and zoom from the style.

### Workaround

The workaround is to either change the style so it doesn't have a default location, or use zoom: 0.01 or center: [0.01, 0].

### PR

I've pushed a unit test which should pass, but is now failing at https://github.com/mapbox/mapbox-gl-js/compare/center-zoom-000, I'm just not sure the best way to fix the issue.

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 unit test referenced in the issue and inspect the center/zoom initialization path in the compare branch at https://github.com/mapbox/mapbox-gl-js/compare/center-zoom-000. Confirm that initializing with center and zoom 0/0/0 overrides the style's location, matching the JSBin demonstration and expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.