mapbox / mapbox/mapbox-gl-draw

midpoint handles misplaced with non-mercator projections

Open
#1,073 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
8d 9h
Merged PRs (30d)
5

Description

**mapbox-gl-js version**: v2.6.0-beta.1
**mapbox-gl-draw version**: main

### Steps to Trigger Behavior

1. map.setProjection('winkelTripel')
2. draw polygon

### Expected Behavior

Midpoints are drawn on the line.

### Actual Behavior

Midpoints are drawn off the line.

screen_shot_2021-10-20_at_2 50 41_pm

I think we might need to interpolate in MercatorCoordinate in stead of LngLat here: https://github.com/mapbox/mapbox-gl-draw/blob/main/src/lib/create_midpoint.js

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 src/lib/create_midpoint.js and reproduce the issue using map.setProjection('winkelTripel') before drawing a polygon. Compare the midpoint positions with the polygon line and verify that the behavior also remains correct under the affected non-Mercator projection.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.