mapbox / mapbox/mapbox-gl-js

some api change map view for example map.flyTo map.easeTo map.fitBounds and map.jumpTo proplems due to transform scale

Open
#11,364 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged 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.3.1

**browser**:chrom

### Steps to Trigger Behavior

1. when canvas container style transform:scale(2) map.flyTo() the center is not in the center of the viewport
2.
3.

### Link to Demonstration



const map = new mapboxgl.Map({
container: "map",
style: "mapbox://styles/mapbox/streets-v11",
center: [117, 39],
zoom: 15,
});
map.on('load',()=>{
setTimeout(()=>{
map.flyTo({
center:[0,0],
zoom:9
})
},2000)
})

![image](https://user-images.githubusercontent.com/30195228/147467757-ed400e43-6ded-46bb-8653-d319980ee3af.png)

https://jsbin.com/

### Expected Behavior
flyTo({center}) is exicitly in the center of viewport

### Actual Behavior
flyTo({center}) is not in the center of viewport

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 supplied reproduction using mapbox-gl-js 2.3.1 in Chrome and a CSS transform:scale(2) on the canvas container. Compare map.flyTo() with map.easeTo(), map.fitBounds(), and map.jumpTo(); done means the requested center is positioned at the viewport center when the container is scaled.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.