Skip to content

Markers moves to incorrect positions when using a "globe" projection with a non-integer zoom level #12592

@benoitv-code

Description

@benoitv-code

Markers are moving out-of-position when dragging the map when using a "globe" projection with a non-integer zoom level (either set programmatically or when a user is zooming in / zooming out)

mapbox-gl-js version: 2.13.0

browser: Chrome 110.0.5481.178

Steps to Trigger Behavior

  1. Use mapbox://styles/mapbox/streets-v12 (or the globe projection mode) with a zoom: 5.5
  2. Set a marker somewhere (like on [-0.481707, 48.916776])
  3. Move the map far to the left and the right, and see the marker moving in wrong positions

Link to Demonstration

Simple repro: https://codepen.io/benoit42/pen/yLxVMMo

Expected Behavior

Marker stays at a correct position when dragging the map

Actual Behavior

Marker moves to incorrect positions when dragging the map from left to right:
2023-02-27 00_16_27-Repro Mapbox globe markers issues when moving map
2023-02-27 00_16_19-Repro Mapbox globe markers issues when moving map

Workaround

Not great, but setting the projection mode to mercator fixes the issue:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions