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

Affix user dot on screen in user tracking mode #3589

Merged
merged 13 commits into from
Jan 20, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[ios] Reset user tracking, respect content inset in resetPosition
  • Loading branch information
1ec5 committed Jan 20, 2016
commit bd4611107ddfe0068afb8f6611deb6cec78c6f73
2 changes: 1 addition & 1 deletion platform/darwin/MGLMapCamera.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ + (instancetype)cameraLookingAtCenterCoordinate:(CLLocationCoordinate2D)centerCo
{
return [[self alloc] initWithCenterCoordinate:centerCoordinate
altitude:distance
pitch:(CGFloat)pitch
pitch:pitch
heading:heading];
}

Expand Down
13 changes: 10 additions & 3 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ typedef NS_ENUM(NSUInteger, MGLUserTrackingState) {
NSString *const MGLMapboxSetupDocumentationURLDisplayString = @"mapbox.com/help/first-steps-ios-sdk";

const NSTimeInterval MGLAnimationDuration = 0.3;

/// Duration of an animation due to a user location update, typically chosen to
/// match a typical interval between user location updates.
const NSTimeInterval MGLUserLocationAnimationDuration = 1.0;

const CGSize MGLAnnotationUpdateViewportOutset = {150, 150};
const CGFloat MGLMinimumZoom = 3;
const NSUInteger MGLTargetFrameInterval = 1; //Target FPS will be 60 divided by this value
Expand Down Expand Up @@ -1630,8 +1635,9 @@ - (void)resetNorthAnimated:(BOOL)animated

- (void)resetPosition
{
_mbglMap->cancelTransitions();
_mbglMap->resetPosition();
MGLMapCamera *camera = [MGLMapCamera camera];
camera.altitude = MGLAltitudeForZoomLevel(0, 0, 0, self.frame.size);
self.camera = camera;
}

- (void)cycleDebugOptions
Expand Down Expand Up @@ -1916,6 +1922,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a

- (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration animationTimingFunction:(nullable CAMediaTimingFunction *)function completionHandler:(nullable void (^)(void))completion
{
self.userTrackingMode = MGLUserTrackingModeNone;
_mbglMap->cancelTransitions();
if ([self.camera isEqual:camera])
{
Expand Down Expand Up @@ -3103,7 +3110,7 @@ - (void)locationManager:(__unused CLLocationManager *)manager didUpdateLocations
edgePadding:insets
zoomLevel:self.zoomLevel
direction:course
duration:animated ? 1 : 0
duration:animated ? MGLUserLocationAnimationDuration : 0
animationTimingFunction:linearFunction
completionHandler:NULL];
}
Expand Down