-
Notifications
You must be signed in to change notification settings - Fork 543
Fix missing location indicator on iOS #176
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
Conversation
As noted in issue flutter-mapbox-gl#138, the default user location indicator is not appearing in accordance with the `myLocationRenderMode` setting. Instead, no indication of the user location appears when that location is within the displayed map. This is the relevant API documentation for the method used to override annotation views: > The user location annotation view can also be customized via this > method. When annotation is an instance of `MGLUserLocation` (or equal > to the map view’s `userLocation` property), return an instance of > `MGLUserLocationAnnotationView` (or a subclass thereof). https://docs.mapbox.com/ios/api/maps/5.6.1/Protocols/MGLMapViewDelegate.html#/Managing%20Annotation%20Views From that it sounds like this controller behaves correctly by returning "an instance" of `MGLUserLocation`, but perhaps the assumption is that this instance will provide a specialized implementation. I wasn't able to find any more information on this. However, the return value for this function is optional. I found that returning `nil` when a MGLUserLocation is requested resulted in the location displaying with a dot as expected. Note: `MyLocationRenderMode.COMPASS` is not supported, and as far as I can tell it is not implemented within the Mapbox iOS SDK. Only a blue dot with no direction arrow is provided. Other render modes may require a custom iOS implementation in flutter-mapbox-gl.
|
@n8han I found the |
Nice find! Yes, setting That leaves |
|
I don't know a lot about iOS development, so I might be totally wrong here, but I found this https://github.com/mapbox/mapbox-gl-native-ios/blob/f489ec2ee131725b42162edf0414241f9c6310d1/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m#L49 |
|
We can follow up on GPS implementation as tailwork, great work @n8han! Thank you for contributing. |
|
👌 I'll open a PR to add the heading indicator after this one merges. |
|
Thank you for continuous support and contributions to the project @n8han, invited you as collaborator so you can directly push to this repo |
As noted in issue flutter-mapbox-gl#138, the default user location indicator is not appearing in accordance with the `myLocationRenderMode` setting. Instead, no indication of the user location appears when that location is within the displayed map. This is the relevant API documentation for the method used to override annotation views: > The user location annotation view can also be customized via this > method. When annotation is an instance of `MGLUserLocation` (or equal > to the map view’s `userLocation` property), return an instance of > `MGLUserLocationAnnotationView` (or a subclass thereof). https://docs.mapbox.com/ios/api/maps/5.6.1/Protocols/MGLMapViewDelegate.html#/Managing%20Annotation%20Views From that it sounds like this controller behaves correctly by returning "an instance" of `MGLUserLocation`, but perhaps the assumption is that this instance will provide a specialized implementation. I wasn't able to find any more information on this. However, the return value for this function is optional. I found that returning `nil` when a MGLUserLocation is requested resulted in the location displaying with a dot as expected. Note: `MyLocationRenderMode.COMPASS` is not supported, and as far as I can tell it is not implemented within the Mapbox iOS SDK. Only a blue dot with no direction arrow is provided. Other render modes may require a custom iOS implementation in flutter-mapbox-gl.
Thanks so much! Should I continue to open PRs for all changes, or just those were I'm unsure and would like some feedback? |
* master: Support setting map's content insets (flutter-mapbox-gl#215) Provide `onMapIdle` callback (flutter-mapbox-gl#214) [example] add full page map example (flutter-mapbox-gl#201) Fix missing location indicator on iOS (flutter-mapbox-gl#176) Returned a nil result so the future completes. (flutter-mapbox-gl#216) Update README: Access Tokens for self-hosted tiles (flutter-mapbox-gl#217) Change annotation priority (flutter-mapbox-gl#222)
As noted in issue #138, the default user location indicator is not
appearing in accordance with the
myLocationRenderModesetting.Instead, no indication of the user location appears when that location
is within the displayed map.
This is the relevant API documentation for the method used to override
annotation views:
https://docs.mapbox.com/ios/api/maps/5.6.1/Protocols/MGLMapViewDelegate.html#/Managing%20Annotation%20Views
From that it sounds like this controller behaves correctly by returning
"an instance" of
MGLUserLocation, but perhaps the assumption is thatthis instance will provide a specialized implementation. I wasn't able
to find any more information on this.
However, the return value for this function is optional. I found that
returning
nilwhen a MGLUserLocation is requested resulted in thelocation displaying with a dot as expected.
Note:
MyLocationRenderMode.COMPASSis not supported, and as far as Ican tell it is not implemented within the Mapbox iOS SDK. Only a blue
dot with no direction arrow is provided. Other render modes may require
a custom iOS implementation in flutter-mapbox-gl.