Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Invalid pixel coordinate (react-map-gl@5.0.4) #846

Closed
adrienj opened this issue Jul 15, 2019 · 7 comments
Closed

Uncaught Error: Invalid pixel coordinate (react-map-gl@5.0.4) #846

adrienj opened this issue Jul 15, 2019 · 7 comments
Assignees
Labels

Comments

@adrienj
Copy link

adrienj commented Jul 15, 2019

Cause:
If you switch from a component rendering the map to another (click on the switch button in the link I provided), then right clicking on map causes an error, then subsequent mouse-move on the map cause the error too. If you do this mutliple times, multiple errors are triggered at the same time, as though the event handlers accumulate.

Result:

assert.js:10 Uncaught Error: invalid pixel coordinate
    at assert (assert.js:10)
    at pixelsToWorld (web-mercator-utils.js:240)
    at WebMercatorViewport.unproject (viewport.js:109)
    at InteractiveMap._normalizeEvent (interactive-map.js:438)
    at eval (interactive-map.js:251)
    at EventRegistrar._emit (event-registrar.js:125)
    at EventRegistrar.handleEvent (event-registrar.js:97)
    at Manager.emit (hammer.js:2631)
    at EventManager._onBasicInput (event-manager.js:387)
    at Manager.emit (hammer.js:2631)
    at PointerEventInput.inputHandler [as callback] (hammer.js:590)
    at PointerEventInput.PEhandler (hammer.js:990)
    at PointerEventInput.handler (hammer-overrides.js:56)
    at Input.domHandler (hammer.js:507)

To reproduce:
https://codesandbox.io/s/wonderful-violet-vnt6y
I'm on Chrome 75.0.3770.100 64bits, OSX 10.14
And Firefox 68.0

@Pessimistress Pessimistress self-assigned this Jul 15, 2019
@Pessimistress
Copy link
Collaborator

This is an interesting bug... We do not remove event listeners upon unmount because we assume the element that they are attached to will be disposed. With your sandbox I can sometimes reproduce the issue, maybe React is doing something funky under the hood...

@xintongxia
Copy link

fixed in 5.0.7

@lougroshek
Copy link

I can replicate this in 5.0.7

@limZyuan
Copy link

Currently using version 5.2.3, could reproduce the pixel error when dragging map with both right and left mouse button down.

@titivermeesch
Copy link

It seems that this issue is still present on 6.1.11. A few users are triggering this issue. Still investigating when this happens

@Morganballat
Copy link

Please let me know if you fixed it

@andeplane
Copy link

@Morganballat I just got this issue because the div containing the map had 0 pixels height.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants