Skip to content

Wrong marker in mouse events #2509

Open
@joric

Description

@joric

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.

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.

  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<<i)), // mandatory zoom levels
    },
}

It only happens on certain zoom levels and with certain markers, though. Maybe a few out of 60 thousand. It doesn't seem there's anything special about those markers besides their index. If i move marker up or down one position in the JSON, the bug disappears. It is also seems to be affected by window height when I open the console and window becomes narrower, so it's probably different for different window sizes. Rounding z-coordinate from -1003.9592 to -1003.95 also seems to fix this marker (probably because after 3d transform it goes into a different R-tree cell).

Video

out.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions