Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
How do I hide the undrawn side of a polygon during draw mode of polygon using mapbox-gl-draw?

The normal function of the polygon draw tool of mapbox-gl-draw, shows the polygon that would be created if you clicked the original point from where you started.

enter image description here

But what I would like is to NOT show the line that hasn't yet been drawn by the user during draw mode.

In this image, the left side and the bottom side are fine because the user placed the top point and the second point at the bottom. But I do not want to see line connecting where my cursor is to the original point.

I am able to remove the fill color by changing the fill styling but I am unable to hide the "ghost" line as it uses the same stroke as the other user-drawn lines.

I have used the section "Lines and polygons" from this link: https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/EXAMPLES.md

What I have tried to edit:

{
    id: "gl-draw-polygon-stroke-active",
    type: "line",
    filter: ["all", ["==", "$type", "Polygon"], ["!=", "mode", "static"]],
    layout: {
      "line-cap": "round",
      "line-join": "round",
    },
    paint: {
      "line-color": "#D20C0C",
      "line-dasharray": [0.2, 2],
      "line-width": 3,
    },
  }

But this changes the stroke of the "ghost" line as well. Is it possible to just hide the ghost line or do I need to make a custom polygon implementation of mapbox-gl-draw polygon mode?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda