mapbox / mapbox/mapbox-gl-js

addInteraction with type ‘wheel’ causes Uncaught TypeError in createFromScreenPoints

Open
#13,425 1 comment 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: 3.7.0

browser: chrome latest

### Steps to Trigger Behavior

1. Use `addInteraction` with the type set to `'wheel'`.
2. Trigger a wheel event (e.g., by scrolling with the mouse wheel over the map).
3. Observe that the error is thrown during the wheel event handling.

### Link to Demonstration

```js
mapbox-gl.js?v=c1486394:17622 Uncaught TypeError: Cannot read properties of undefined (reading ‘0’)
at Xe.createFromScreenPoints (mapbox-gl.js?v=c1486394:17622:59)
at To._queryRenderedFeatures (mapbox-gl.js?v=c1486394:22766:72)
at To.queryRenderedTargets (mapbox-gl.js?v=c1486394:22762:29)
at ol.queryTargets (mapbox-gl.js?v=c1486394:28488:35)
at ol.handleType (mapbox-gl.js?v=c1486394:28504:29)
at Map.fire (mapbox-gl.js?v=c1486394:1852:39)
at un._firePreventable (mapbox-gl.js?v=c1486394:27058:27)
at un.wheel (mapbox-gl.js?v=c1486394:27021:25)
at $n.handleEvent (mapbox-gl.js?v=c1486394:27901:108)
```

### Expected Behavior
zoom in or out of map

### Actual Behavior
cannot zoom in or out cause of above error

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 at addInteraction's wheel handling and follow queryTargets and _queryRenderedFeatures into createFromScreenPoints, using the provided stack trace as the entry path. Reproduce the listed wheel interaction in Chrome and confirm that wheel events zoom without throwing the TypeError.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.