mapbox / mapbox/mapbox-gl-draw

How could I style only specific points, for example the first point in a vertex and the rest.

Open
#1,126 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I would like to style only the first point in a vertex, as well as the remaining.
I understand is using something like this:

// vertex points HERE IS WHERE WE NEED TO FILTER THE POINT.
{
id: "gl-draw-polygon-and-line-vertex-active",
type: "circle",
filter: [
"all",
["==", "meta", "vertex"],
["==", "$type", "Point"],
["!=", "mode", "static"],
],
paint: {
"circle-radius": 8,
"circle-color": "#D20C0C",
},
},

but I can't find any example of being able to filter particular points ie: the first only, the remaining, second third... so forth.

Any help thank you ahead of time

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 the `gl-draw-polygon-and-line-vertex-active` layer filter shown in the issue and inspect how vertex point properties are exposed to Mapbox GL styling. Determine whether point order can be used for filtering, then establish a supported way to style the first vertex separately from the remaining vertices and verify both styles in a drawing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.