Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Too much friction when flicking (short-distance panning) the map #1266

Closed
1ec5 opened this issue Apr 14, 2015 · 5 comments · Fixed by #1292
Closed

Too much friction when flicking (short-distance panning) the map #1266

1ec5 opened this issue Apr 14, 2015 · 5 comments · Fixed by #1292
Assignees
Labels
iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage

Comments

@1ec5
Copy link
Contributor

1ec5 commented Apr 14, 2015

@lbud showed me today that the way MGLMapView handles panning gestures seems to impede navigation more than MapKit and the Google Maps SDK, as measured by the (very handy!) ease-of-getting-across-town metric. Part of this perception may come from #1258, but we definitely differ from those frameworks in other ways as well.

Here’s the first thing that comes to mind: in Mapbox GL, “flicking” the map doesn’t cause it to travel as far, and it takes a more robust pan gesture to register a flick. Both MapKit and the Google Maps SDK are more sensitive to flicks. The result is that you feel more friction while navigating.

I don’t have a good setup for scientifically comparing our gesture recognition, but in the name of pseudoscience, I positioned an MGLMapView and a MKMapView both so that Twp. Rd. E in Williams Co., OH, is at the bottom at roughly the same zoom level. (This county built roads in a mostly regular grid, numbering north-south roads and lettering east-west roads, surely anticipating this experiment.) In the screen recordings below, 16 downward flicks of roughly the same length and speed sent the MGLMapView north to Co. Rd. I but the MKMapView all the way to SR 34 (which would be J on the grid):

mapbox mapkit

On a device, the same gestures also took the MGLMapView to Co. Rd. I but sent the MKMapView past I-80/90 (roughly O on the grid). Google Maps sped all the way to Co. Rd. S.

It’s important to get this gesture right because it’s probably going to be the most common.

@1ec5 1ec5 added iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage labels Apr 14, 2015
@incanus
Copy link
Contributor

incanus commented Apr 14, 2015

Interesting, I don't use it this way at all, but my gestures are totally influenced by my development!

/cc @mourner, who tweaked our current inertial pan last.

@mourner
Copy link
Member

mourner commented Apr 14, 2015

@1ec5 can you try fiddling with the deceleration and ease parameters here? https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/MGLMapView.mm#L661 E.g. decreasing deceleration will make it travel further, and changing ease will alter the slowdown curve.

@ljbade
Copy link
Contributor

ljbade commented Apr 15, 2015

It would be nice to take the values you end up with here and using them for panning on Android too. Flicking is rather broken on Android currently though.

@1ec5 1ec5 self-assigned this Apr 15, 2015
@1ec5
Copy link
Contributor Author

1ec5 commented Apr 15, 2015

I’m continuing to play with the constants, with an eye towards making the map feel as slippery as a UIScrollView. Unfortunately, making the map slipperier exacerbates our low framerate when panning.

1ec5 added a commit that referenced this issue Apr 17, 2015
Replaced the complex formula for overpanning with a simple one that makes the map feel much slipperier than before. `MGLMapView` now overpans just a little more aggressively than `MKMapView` but still a lot less aggressively than Google Maps.

Fixes #1266.
@1ec5 1ec5 mentioned this issue Apr 17, 2015
3 tasks
@1ec5
Copy link
Contributor Author

1ec5 commented Apr 17, 2015

The framerate didn’t turn out to be impacted by 2bc63f7 after all. I was probably seeing minor performance degradation due to increased tile loading from panning farther each time, but it’s pretty smooth overall.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants