Skip to content

Commit

Permalink
[Shapes] Fixes for the shape shadow layer if the borderWidth is set m…
Browse files Browse the repository at this point in the history
…ultiple times and there isn't a prepareShadowPath pass.

PiperOrigin-RevId: 322888549
  • Loading branch information
yarneo authored and material-automation committed Jul 23, 2020
1 parent 49b441e commit a5ddb26
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/Shapes/src/MDCShapedShadowLayer.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ - (void)setPath:(CGPathRef)path {

- (void)generateColorPathGivenLineWidth {
if (CGPathIsEmpty(self.path) || _colorLayer.lineWidth <= 0) {
_colorLayer.path = _shapeLayer.path;
return;
}
CGFloat halfOfBorderWidth = self.shapedBorderWidth / 2.f;
Expand All @@ -126,7 +127,7 @@ - (void)generateColorPathGivenLineWidth {
transform = CGAffineTransformScale(transform, CGRectGetWidth(insetBounds) / width,
CGRectGetHeight(insetBounds) / height);
}
_colorLayer.path = CGPathCreateCopyByTransformingPath(_colorLayer.path, &transform);
_colorLayer.path = CGPathCreateCopyByTransformingPath(_shapeLayer.path, &transform);
}

- (CGPathRef)path {
Expand Down

0 comments on commit a5ddb26

Please sign in to comment.