mapbox / mapbox/mapbox-gl-js

Listener attached to the line layer with the added line width not working correctly.

Open
#12,399 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: ^2.10.0
**browser**: Brave v1.45.127

### Steps to Trigger Behavior

https://codepen.io/gmand/pen/RwJxvbx

Open the console and try to hover near the first marker (dotted lines in the pic). You will see in the console output "hover" .

![image](https://user-images.githubusercontent.com/351018/203008778-3582102b-9a78-4d28-89f0-b5a403c51043.png)

### Expected Behavior

It should trigger the listener event only when you hovering on the actual line, no matter what width is added. The line should not go passed the marker points

### Actual Behavior

The line width seems to acts as a padding. If you set the width to 40, it should only add this width to 2 directions. Seems like the rendering is correct but the way the listener is attached is wrong.

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 linked CodePen reproduction and inspect the line-layer hover listener behavior around the first marker. Compare the listener's hit area with the rendered line at different widths; done means hover triggers only on the actual line and the added width does not extend beyond the marker points.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.