mapbox / mapbox/mapbox-gl-draw

Is there a way to change the transparency/color of only the final unset line of a polygon?

Open
#1,150 0 comments 0 reactions 0 assignees View on GitHub
auto-triaged feature
Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
8d 9h
Merged PRs (30d)
5

Description

**mapbox-gl-js version**: 1.12.2
**mapbox-gl-draw version**: 1.3.0

### Steps to Trigger Behavior

1. Start drawing a polygon
2. Before closing the polygon, line appears connecting the first and current point

### Expected Behavior
I want this line to be transparent, while the rest of the polygon lines match what's in my custom styling.

### Actual Behavior
The unset polygon line is indistinguishable from the other polygon lines.

### Custom 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': '#FF0000',
'line-dasharray': [0.2, 2],
'line-width': 2,
},
}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing polygon drawing with the custom active-stroke style shown in the issue, using mapbox-gl-draw 1.3.0 and mapbox-gl-js 1.12.2. Trace how the active polygon stroke is styled before the polygon is closed, then determine whether the final unset line can have separate transparency or color. Done means that line is visually distinct while the remaining polygon lines retain the custom styling.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.