mapbox / mapbox/mapbox-gl-draw

Double line appears after drawing first two vertices when creating a polygon

Open
#1,151 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug
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:
![Screen Shot 2023-01-30 at 1 58 43 PM](https://user-images.githubusercontent.com/76498844/215569747-d093eb5c-bb0c-4b13-ba18-4cb231dd0b63.png)

After click:
![Screen Shot 2023-01-30 at 1 58 55 PM](https://user-images.githubusercontent.com/76498844/215569772-348f3cd9-fb18-478e-a368-05459e9eded4.png)

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.