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

Commit

Permalink
Pitch the dot
Browse files Browse the repository at this point in the history
This exposes the naïveté of the current pitch transform: accuracy ring sizing stays constant, despite vertical screen movement. Still, it looks better pitched than not.
  • Loading branch information
friedbunny committed Sep 4, 2015
1 parent 45c0938 commit 2eba2ce
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions platform/ios/MGLUserLocationAnnotationView.m
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ - (void)setupLayers
if (CLLocationCoordinate2DIsValid(self.annotation.coordinate))
{
(_mapView.userTrackingMode == MGLUserTrackingModeFollowWithCourse) ? [self drawPuck] : [self drawDot];
[self updatePitch];
}
}

- (void)updatePitch
{
if (self.mapView.pitch && (self.mapView.pitch != _oldPitch))
{
CATransform3D t = CATransform3DRotate(CATransform3DIdentity, MGLRadiansFromDegrees(self.mapView.pitch), 1.0, 0, 0);
self.layer.sublayerTransform = t;

_oldPitch = self.mapView.pitch;
}
}

Expand Down Expand Up @@ -137,14 +149,6 @@ - (void)drawPuck

[self.layer addSublayer:_puckArrow];
}

if (self.mapView.pitch && (self.mapView.pitch != _oldPitch))
{
CATransform3D t = CATransform3DRotate(CATransform3DIdentity, MGLRadiansFromDegrees(self.mapView.pitch), 1.0, 0, 0);
self.layer.sublayerTransform = t;

_oldPitch = self.mapView.pitch;
}
}

- (UIBezierPath *)puckArrow
Expand Down Expand Up @@ -172,8 +176,6 @@ - (void)drawDot
_puckArrow = nil;

_puckModeActivated = NO;

self.layer.sublayerTransform = CATransform3DIdentity;
}

// update heading indicator
Expand Down

0 comments on commit 2eba2ce

Please sign in to comment.