mapbox / mapbox/mapbox-gl-draw
Double line appears after drawing first two vertices when creating a polygon
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
**mapbox-gl-js version**: 1.3.0
**mapbox-gl-draw version**: 1.12.2
### Steps to Trigger Behavior
1. Draw two points on a polygon and move mouse to place the third point
### Expected Behavior
Only one line should appear connecting the first and second polygon vertices.
### Actual Behavior
The DrawLine and first polygon line appear between the first and second vertices and overlap which looks messy. I would like the DrawLine to only show before we place the second point. If I remove the drawline all together then no line is show when I am placing the second point.
Before click:

After click:

Styling:
` {
id: 'gl-draw-polygon-stroke-active',
type: 'line',
filter: ['all', ['==', 'active', 'true'], ['==', '$type', 'Polygon']],
layout: {
'line-cap': 'round',
'line-join': 'round',
},
paint: {
'line-color': polygonColorFormula,
'line-dasharray': [0.2, 2],
'line-width': 2,
},
},
{
id: 'gl-draw-line-active',
type: 'line',
filter: ['all', ['==', '$type', 'LineString'], ['==', 'active', 'true']],
layout: {
'line-cap': 'round',
'line-join': 'round',
},
paint: {
'line-color': polygonColorFormula,
'line-dasharray': [0.2, 2],
'line-width': 2,
'line-opacity': lineOpacity,
},
},`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior using mapbox-gl-js 1.3.0 and mapbox-gl-draw 1.12.2 by placing two polygon points and moving the mouse. Start by examining the gl-draw-polygon-stroke-active and gl-draw-line-active styles shown in the issue. Done means only one line is visible between the first two vertices while placing the third point.
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
- 38/100