You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Looking at Stackoverflow post here it seems like MGLUserLocation::setLocation tests the distance between new and old locations before actually setting the new value. Because the initial latitude and longitude as set to MAXFLOAT, one of the conditionals checking distance always returns zero, preventing the new location value from being set:
- (void)setLocation:(CLLocation *)newLocation {
if ([newLocation distanceFromLocation:_location] /* always zero? */
&& newLocation.coordinate. latitude != 0
&& newLocation.coordinate.longitude != 0)`...
I think this may be preventing the display of the MGLUserLocation annotation.
To test out my theory, I made the small change below (MGLUserLocation.m) and it seems to have worked - the MGLUserAnnotation now renders on my map as a pulsating circle.
- (void)setLocation:(CLLocation *)newLocation
{
// new code to test my theory out
if(_location.coordinate.latitude == MAXFLOAT || _location.coordinate.longitude == MAXFLOAT) {
[self willChangeValueForKey:@"location"];
_location = newLocation;
[self didChangeValueForKey:@"location"];
}`
else if ([newLocation distanceFromLocation:_location] && newLocation.coordinate. latitude != 0 &&
newLocation.coordinate.longitude != 0)
{
[self willChangeValueForKey:@"location"];
_location = newLocation;
[self didChangeValueForKey:@"location"];
}
}
I have occasionally noticed an issue that I've been meaning to report with the user dot related to wrapped panning horizontally and the dot prematurely then disappearing. Try zooming out all the way, panning the world past a few times, and see what I mean. Not sure if related.
Activity
JohnRbk commentedon Jul 22, 2015
Forgot to mention: Xcode 7 Beta 3, 0.5.2 mapbox-gl build, targeting ios9.
1ec5 commentedon Jul 22, 2015
Yes, this looks like an iOS 9-specific issue and the fix appears to work.
incanus commentedon Jul 22, 2015
I have occasionally noticed an issue that I've been meaning to report with the user dot related to wrapped panning horizontally and the dot prematurely then disappearing. Try zooming out all the way, panning the world past a few times, and see what I mean. Not sure if related.
1ec5 commentedon Jul 22, 2015
@incanus, I’m pretty sure that’s #1755.
Bail if setting user dot to invalid location
Ignore invalid location updates
Ignore invalid location updates
Avoid nudging transitions if a gesture is in progress mapbox#2