diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ebb9d573..1392553a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## master * Add your own contributions to the next release on the line below this with your name. +- **Important** ASDisplayNode's cornerRadius is a new thread-safe bridged property that should be preferred over CALayer's. Use the latter at your own risk! [Huy Nguyen](https://github.com/nguyenhuy) [#749](https://github.com/TextureGroup/Texture/pull/749). - [ASCellNode] Adds mapping for UITableViewCell focusStyle [Alex Hill](https://github.com/alexhillc) [#727](https://github.com/TextureGroup/Texture/pull/727) - [ASNetworkImageNode] Fix capturing self in the block while loading image in ASNetworkImageNode. [Denis Mororozov](https://github.com/morozkin) [#777](https://github.com/TextureGroup/Texture/pull/777) - [ASTraitCollection] Add new properties of UITraitCollection to ASTraitCollection. [Yevgen Pogribnyi](https://github.com/ypogribnyi) diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index feecc3ad9..49f2d917c 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -659,6 +659,12 @@ extern NSInteger const ASDefaultDrawingPriority; * @default ASCornerRoundingTypeDefaultSlowCALayer */ @property (nonatomic, assign) ASCornerRoundingType cornerRoundingType; // default=Slow CALayer .cornerRadius (offscreen rendering) + +/** @abstract The radius to use when rounding corners of the ASDisplayNode. + * + * @discussion This property is thread-safe and should always be preferred over CALayer's cornerRadius property, + * even if corner rounding type is ASCornerRoundingTypeDefaultSlowCALayer. + */ @property (nonatomic, assign) CGFloat cornerRadius; // default=0.0 @property (nonatomic, assign) BOOL clipsToBounds; // default==NO diff --git a/Source/Private/ASDisplayNode+UIViewBridge.mm b/Source/Private/ASDisplayNode+UIViewBridge.mm index a3eceb741..578caa7f6 100644 --- a/Source/Private/ASDisplayNode+UIViewBridge.mm +++ b/Source/Private/ASDisplayNode+UIViewBridge.mm @@ -186,17 +186,12 @@ - (void)setAlpha:(CGFloat)newAlpha - (CGFloat)cornerRadius { ASDN::MutexLocker l(__instanceLock__); - if (_cornerRoundingType == ASCornerRoundingTypeDefaultSlowCALayer) { - return self.layerCornerRadius; - } else { - return _cornerRadius; - } + return _cornerRadius; } - (void)setCornerRadius:(CGFloat)newCornerRadius { - ASDN::MutexLocker l(__instanceLock__); - [self updateCornerRoundingWithType:_cornerRoundingType cornerRadius:newCornerRadius]; + [self updateCornerRoundingWithType:self.cornerRoundingType cornerRadius:newCornerRadius]; } - (ASCornerRoundingType)cornerRoundingType @@ -207,8 +202,7 @@ - (ASCornerRoundingType)cornerRoundingType - (void)setCornerRoundingType:(ASCornerRoundingType)newRoundingType { - ASDN::MutexLocker l(__instanceLock__); - [self updateCornerRoundingWithType:newRoundingType cornerRadius:_cornerRadius]; + [self updateCornerRoundingWithType:newRoundingType cornerRadius:self.cornerRadius]; } - (NSString *)contentsGravity