From 2eba2cee3c51ff7de016255c36cdf5b30530ed91 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Fri, 4 Sep 2015 01:32:34 -0400 Subject: [PATCH] =?UTF-8?q?Pitch=20the=20dot=20This=20exposes=20the=20na?= =?UTF-8?q?=C3=AFvet=C3=A9=20of=20the=20current=20pitch=20transform:=20acc?= =?UTF-8?q?uracy=20ring=20sizing=20stays=20constant,=20despite=20vertical?= =?UTF-8?q?=20screen=20movement.=20Still,=20it=20looks=20better=20pitched?= =?UTF-8?q?=20than=20not.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platform/ios/MGLUserLocationAnnotationView.m | 22 +++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/platform/ios/MGLUserLocationAnnotationView.m b/platform/ios/MGLUserLocationAnnotationView.m index e1f57c764d1..60207f8e83d 100644 --- a/platform/ios/MGLUserLocationAnnotationView.m +++ b/platform/ios/MGLUserLocationAnnotationView.m @@ -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; } } @@ -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 @@ -172,8 +176,6 @@ - (void)drawDot _puckArrow = nil; _puckModeActivated = NO; - - self.layer.sublayerTransform = CATransform3DIdentity; } // update heading indicator