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

Gestures are not handled #1700

Closed
HarelM opened this issue Mar 19, 2022 · 3 comments
Closed

Gestures are not handled #1700

HarelM opened this issue Mar 19, 2022 · 3 comments
Assignees
Labels
App Native application related issues bug Critical Needs to be fix ASAP

Comments

@HarelM
Copy link
Member

HarelM commented Mar 19, 2022

Bug

What I expect to happen

I should be able to move the map using gestures on mobile devices

What really happened

The map is not responsive to gestures for a short period of time

What I did that caused the issue - step by step

One of the scenarios I'm able to reproduce fairly easily:

  1. Activate GPS
  2. Let it find the location and the start showing the direction of the phone when not moving around, but only rotating the phone
  3. Pan the map
  4. Click center me
  5. Let the map center
  6. Try and pan it again --> it takes a few seconds for it to work.

My environment

  • Operating System and version: android 11
  • Web Browser and version:

Things I think the developers should know, images, links etc.

When disabling the GPS this solves the issue immediately so I tend to think this is related to the compass operation, maybe.

@HarelM HarelM added the bug label Mar 19, 2022
@HarelM HarelM self-assigned this Mar 19, 2022
@zstadler
Copy link
Member

I'm also able to reproduce the issue this way:

  1. Activate GPS
  2. Place the device on any surface and do no move or touch it for 10 seconds
  3. Try and pan it --> it takes a few seconds for it to work.

@HarelM HarelM added the Critical Needs to be fix ASAP label Mar 19, 2022
@HarelM HarelM added this to the Next Release milestone Mar 19, 2022
@HarelM HarelM added the App Native application related issues label Mar 19, 2022
@HarelM HarelM modified the milestones: Version 9.12.52, Next Release Mar 19, 2022
@HarelM
Copy link
Member Author

HarelM commented Mar 20, 2022

Resolved by #1702 hopefully.

@HarelM HarelM closed this as completed Mar 20, 2022
@HarelM
Copy link
Member Author

HarelM commented Mar 26, 2022

We have narrowed down this problem back to between version 9.9.56 and 9.9.76 of the app.
In 9.9.76 we introduced maplibre-gl which is the equivalent of mapbox-gl version 1.13.
Before that we were on mapbox version 1.10.0-beta.1.
The following issue seems to resemble the problem.
mapbox/mapbox-gl-js#9793
@VigibotDev @andycalder did you guys see other issues related to gesture handling that got the map to stop responding to gestures?

What I see on my end is that I use the compass to update the map at 10Hz frequency, and it causes the map to sometime stop responding to gestures.

I did write a short attempt to reproduce in jsbin:
https://jsbin.com/mejipuyitu/edit?html,output

Basically if I change the version there to 1.10.0-beta.1 I can pan the map using the mouse, but If I upgrade this example to 1.13.0 then I can no longer pan the map using the mouse.
Is this by design?

As a temporary fix I reduced the compass' frequency to 2Hz but it seems like a workaround and not a fix...
If you guys found something better or if you can point me to where to look of the issue it would be great.

The following is the jsbin code, just for safe keeping:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Add a line to a map using a GeoJSON source</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<link href="https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.css" rel="stylesheet">
<script src="https://api.mapbox.com/mapbox-gl-js/v1.10.0-beta.1/mapbox-gl.js"></script> <!-- !!change version here!! -->
<style>
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
    const map = new mapboxgl.Map({
        container: 'map',
        style: {
          version: 8,
          sources: {
            osm: {
              type: "raster",
              tiles: ["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"],
              tileSize: 256,
              maxzoom: 19
            }
          },
          layers: [
            {
              id: 'simple-tiles',
              type: 'raster',
              source: 'osm',
              minzoom: 0,
              maxzoom: 22
            }
          ]
        },
        center: [-122.486052, 37.830348],
        zoom: 15
    });

    map.on('load', () => {
      let index = 0;
      setInterval(() => {
        if (!map.isMoving()) {
         index+=3;
         map.easeTo({
            bearing: index,
            //center: map.getCenter(),
            //zoom: map.getZoom(),
            animate: true,
            easing: (x) => x,
            offset: [0, 100]
          });     
        }      
      }, 100)
    });
</script>

</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Native application related issues bug Critical Needs to be fix ASAP
Projects
None yet
Development

No branches or pull requests

2 participants