Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marker's pixel position is incorrect when map container's width very large. #12067

Open
george-hong opened this issue Jul 7, 2022 · 2 comments
Labels

Comments

@george-hong
Copy link

george-hong commented Jul 7, 2022

mapbox-gl-js version:

mapbox 2.9.1

browser:

Chrome 103.0.5060.66

FireFox 102.0

Steps to Trigger Behavior

  1. open the demonstration and move scroller to center
  2. find the marker
  3. move or zoom map

Link to Demonstration

https://jsfiddle.net/domore/1Lpza0c5/2/

Expected Behavior

marker can stay it's coordinate correctly (offset was increased by the width of container)

Actual Behavior

marker looks like drift

20220720_151125.mp4
@abdul-Tz-prog
Copy link

Hello, I am also facing this issue (marker moving on zoom-in). I already used: import 'mapbox-gl/dist/mapbox-gl.css'; in my react-laravel mix application, it is not working. I looked for other solutions on StackOverflow and other platforms but did not find any solution. Is this really a bug from the mapbox-react side or am I missing something?

@benoitv-code
Copy link

benoitv-code commented Feb 26, 2023

I had the same issue when using Mapbox 2.13.0, markers were moving out-of-position on some zoom levels when moving the map.

Root cause: The root cause of the bug was Mapbox defaulting to a globe projection mode, which apparently has issues when using a non-integer zoom level (like 5.5), either programatically or when a user is zooming in / zooming out.

Workaround: I fixed the issue by setting the projection mode to mercator:

    let map = new mapboxgl.Map({
     /* ... */
      projection: { name: "mercator" },
    });

Edit: Actually it doesn't seem to be the same bug as the original issue, I am opening a new one specific to this issue: #12592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants