-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios] snap to north if interaction ends within ±7° #3403
Conversation
Going to leave this convenient - (void)mapViewRegionIsChanging:(__unused MGLMapView *)mapView
{
[self updateDirectionDebug];
}
- (void)mapView:(__unused MGLMapView *)mapView regionDidChangeAnimated:(__unused BOOL)animated
{
[self updateDirectionDebug];
}
- (void)updateDirectionDebug
{
if (! _directionDebug)
{
_directionDebug = [[UILabel alloc] initWithFrame:CGRectMake(250, 100, 100, 50)];
[self.view addSubview:_directionDebug];
}
_directionDebug.text = [NSString stringWithFormat:@"%.2f", self.mapView.direction];
} |
Could this be done as part of |
I'm looking into integrating it in |
I went ahead and integrated the snapping with I've not copied the delayed animations and disabled user interaction that exists just above in |
@@ -3053,6 +3055,10 @@ - (void)unrotateIfNeededAnimated:(BOOL)animated | |||
[self resetNorthAnimated:NO]; | |||
} | |||
} | |||
else if (self.compassView.alpha > 0 && (self.direction < snapTolerance || self.direction > 360 - snapTolerance)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the developer hides the compass view? Shouldn’t the map view snap to north regardless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, will look at changing this.
Ergh, accidentally included iosapp debug code. Will back that out. |
4f2c56c
to
e4d8494
Compare
Rebased and squashed. |
If a user pinch-rotates and the gesture ends within ±7° of north, reset to north (0°).
This behavior is the same as in MapKit.
First proposed in #938, implemented in #1059, reverted in #1064. (Closes #1064.)
/cc @1ec5