-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] Restrict panning of map with offline downloaded map #5042
Comments
Previous discussion in #2457. This is complicated by the fact that this SDK allows rotation and tilting, whereas that wasn’t possible with the old SDK. In some cases, it would be OK for the user to see beyond the bounds by rotating and tilting, whereas for the case you describe, that would be suboptimal. Another consideration is that we intend to eventually allow offline regions to be non-rectangular, at which point the |
This is one of the critical features for stay.com. |
For starters, I’ve implemented the simplest possible API for restricting movement in #5584. With this API, it should be possible to implement logic to restrict gestures based on regions already downloaded for offline use, but we should keep this ticket open to investigate more concise or automatic approaches. |
As of #5584, you can implement the |
When you download an offline map you provide the
MGLTilePyramidOfflineRegion
initialiser a bounds struct which downloads a specific part of a map.When you use the offline map, the user is able to scroll around and sees blank tiles for parts outside the map that have been downloaded.
It should be possible to restrict the map to only pan within certain bounds.
You could implement
- (void)mapView:(MGLMapView *)mapView regionDidChangeAnimated:(BOOL)animated
, but then you have to manually check if the current visible screen bounds is outside the downloaded bounds.In the previous version of the Mapbox SDK this was possible with a certain method where you would pass in the NE en SW coordinate and you couldn't scroll past those.
Platform: iOS
Mapbox SDK version: 3.2.2
Steps to trigger behavior
Expected behavior
You can only scroll within the bounds that have been downloaded.
Actual behavior
You can scroll everywhere, so you get to see blank tiles when the app runs in offline mode.
The text was updated successfully, but these errors were encountered: