mapbox / mapbox/mapbox-gl-js

Mouse events not working right on circle layers with sub-properties

Open
#9,469 11 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

mapbox-gl-js version: v1.9.0

browser: Chrome

Steps to Trigger Behavior
  1. Create a GeoJSON point feature that has sub-properties of properties (f.properties.subProperty)
  2. Create a circle layer with an expression that uses the sub-property for the radius.
  3. Add mouse enter/leave events that change the mouse cursor.
  4. Hover over the circle. You will find that the mouse events only work when really close to the center of the circle.
Link to Demonstration

https://jsbin.com/zahogipeqo/edit?html,output

Expected Behavior

Mouse events should work as soon as the mouse hits the edge of the circle.

Actual Behavior

The mouse events only work when really close to the center of the circle.

Additional information

I initially noticed this when using a a linear expression, but after simplifying this to simplifying grabbing the sub-property value and using it for the radius, I saw the same issue.

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 JSBin reproduction and verify the circle layer's sub-property radius together with the mouse enter/leave handlers in Chrome. Compare the observed hit area with the rendered circle edge; done means the handlers respond across the full circle, not only near its center.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.