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

Panning off map causes map view to jump in Edge #8116

Closed
rbrundritt opened this issue Apr 3, 2019 · 2 comments
Closed

Panning off map causes map view to jump in Edge #8116

rbrundritt opened this issue Apr 3, 2019 · 2 comments

Comments

@rbrundritt
Copy link

rbrundritt commented Apr 3, 2019

When using Edge browser, if you pan the map and drag the cursor outside of the map div, the center of the map jumps a full width/height of the map to another location. Here is an example:

mapbox-pan-off-map-issue

I was able to reproduce this with multiple examples on the examples page: https://docs.mapbox.com/mapbox-gl-js/example/simple-map/

I haven't gotten access to the new version of Edge which is based on chromium, it's possible that this issue may be resolved in that version when it becomes available, but logging this issue so it can be tested then.

mapbox-gl-js version: 0.53.1

browser: Edge (version 44.17763.1.0)

Steps to Trigger Behavior

  1. Open one of the examples in Edge browser.
  2. Start panning the map via mouse down.
  3. Drag the mouse cursor outside of the map div, watch the map view jump.

Expected Behavior

Map would continue to pan without the map center jumping to another location far away. Similar to what happens in other browsers.

Actual Behavior

The map center jumps to a location about the width/height distance of the map div.

@mourner
Copy link
Member

mourner commented Apr 4, 2019

Thanks for the report! Looks like Edge is behaving differently when calculating mouse position, possibly if the map is in an iframe. The relevant util function is here:

DOM.mousePos = function (el: HTMLElement, e: any) {
const rect = el.getBoundingClientRect();
e = e.touches ? e.touches[0] : e;
return new Point(
e.clientX - rect.left - el.clientLeft,
e.clientY - rect.top - el.clientTop
);
};

Would you mind exploring a fix for this? We'd gladly accept a PR.

@rbrundritt
Copy link
Author

Good news, the new version of Edge is available publicly for testing now here: https://www.microsoftedgeinsider.com I just tested and found that this issue is resolved in there. I believe this version of the browser is planned to be released to Windows later this year, at which point, not long after most users of Edge will likely be using that version. With this in mind, likely best to just wait for that version as likely not worth fixing something that will be irrelevant later this year.

I've done some testing and found this also resolves: #1928

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

No branches or pull requests

2 participants