maptalks / maptalks/maptalks.js

Wrong marker in mouse events

Open
#2,509 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
4.5k
Forks
511
Avg merge
3d 58m
Merged PRs (30d)
1

Description

Latest maptalks-gl from CDN (maptalks-gl v0.105.4). Sometimes mouse events have a wrong target marker. That happened multiple times with different markers. Mobile simulator is also affected.

I'd love to have a smaller reproducible example but I only got this, if you go the link below and zoom back and forth you eventually notice that hover and click events don't match the marker.

* https://joric.github.io/stalker#050DB9A84EA309D1988B7AA64A673BC9

I can only guess what happens, but it's probably an R-tree (or another spatial structure) bug. The other marker is usually not far away. Maybe it happens because I use rectangular CRS and it's fairly large, 8129000 pixels so float precision may be not enough.

```js
map = new maptalks.Map('map', {
spatialReference : {
projection : 'identity',
fullExtent : { top: top, left: left, bottom: bottom, right: right }, // mandatory to hide 404
resolutions: Array.from({length: maxZoom + 1},(_,i) => w / tileSize / (1<

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 reproducible example and the mouse-event handling for markers, then reproduce the mismatch while changing zoom level, window size, marker order, and marker coordinates. Done means hover and click events consistently target the marker under the pointer in the reported scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.