1

I'm using mapbox GL js to display linestrings.

Those linestrings are clickable in order to display various information about the linstring in a popup using :

      new mapboxgl.Popup()
          .setLngLat(coordinates)
          .setHTML(popup)
          .addTo(map);

But I have the feeling that the clickable area where the popup is displayed is very narrow. It can even manage to display the popup everytime on the first clic...

Is there a way to enlarge this zone ? Thanks

testadaz
  • 39
  • 5

1 Answers1

1

A common work around I use is to create a second line layer underneath, with a line-opacity of 0.01 and a line-width of 10. Add the click handler onto that line instead.

Steve Bennett
  • 114,604
  • 39
  • 168
  • 219