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

Commit

Permalink
Don't re-set shadow properties
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbunny committed Sep 4, 2015
1 parent c40a88e commit eaba077
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions platform/ios/MGLUserLocationAnnotationView.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,18 @@ - (void)updatePitch

- (void)updateFaux3DEffect
{
if (self.mapView.pitch)
{
CGFloat pitch = MGLRadiansFromDegrees(self.mapView.pitch);
CGFloat pitch = MGLRadiansFromDegrees(self.mapView.pitch);

if (_puckDot)
{
_puckDot.shadowOffset = CGSizeMake(0, fmaxf(pitch * 10, 1));
_puckDot.shadowRadius = fmaxf(pitch * 5, 0.75);
}
if (_puckDot)
{
_puckDot.shadowOffset = CGSizeMake(0, fmaxf(pitch * 10, 1));
_puckDot.shadowRadius = fmaxf(pitch * 5, 0.75);
}

if (_dotBorderLayer)
{
_dotBorderLayer.shadowOffset = CGSizeMake(0, pitch * 10);
_dotBorderLayer.shadowRadius = fmaxf(pitch * 5, 3);
}
if (_dotBorderLayer)
{
_dotBorderLayer.shadowOffset = CGSizeMake(0, pitch * 10);
_dotBorderLayer.shadowRadius = fmaxf(pitch * 5, 3);
}
}

Expand All @@ -149,11 +146,17 @@ - (void)drawPuck
_puckDot = [self circleLayerWithSize:MGLUserLocationAnnotationPuckSize];
_puckDot.backgroundColor = [[UIColor whiteColor] CGColor];
_puckDot.shadowColor = [[UIColor blackColor] CGColor];
_puckDot.shadowOffset = CGSizeMake(0, 1);
_puckDot.shadowRadius = 0.75;
_puckDot.shadowOpacity = 0.25;

[self updateFaux3DEffect];
if (self.mapView.pitch)
{
[self updateFaux3DEffect];
}
else
{
_puckDot.shadowOffset = CGSizeMake(0, 1);
_puckDot.shadowRadius = 0.75;
}

[self.layer addSublayer:_puckDot];
}
Expand Down Expand Up @@ -334,11 +337,17 @@ - (void)drawDot
_dotBorderLayer = [self circleLayerWithSize:MGLUserLocationAnnotationDotSize];
_dotBorderLayer.backgroundColor = [[UIColor whiteColor] CGColor];
_dotBorderLayer.shadowColor = [[UIColor blackColor] CGColor];
_dotBorderLayer.shadowOffset = CGSizeMake(0, 0);
_dotBorderLayer.shadowRadius = 3;
_dotBorderLayer.shadowOpacity = 0.25;

[self updateFaux3DEffect];
if (self.mapView.pitch)
{
[self updateFaux3DEffect];
}
else
{
_dotBorderLayer.shadowOffset = CGSizeMake(0, 0);
_dotBorderLayer.shadowRadius = 3;
}

[self.layer addSublayer:_dotBorderLayer];
}
Expand Down

0 comments on commit eaba077

Please sign in to comment.