diff --git a/AsyncDisplayKit/Layout/ASLayoutElement.h b/AsyncDisplayKit/Layout/ASLayoutElement.h index e7680abc0b..e933ee36e3 100644 --- a/AsyncDisplayKit/Layout/ASLayoutElement.h +++ b/AsyncDisplayKit/Layout/ASLayoutElement.h @@ -302,66 +302,6 @@ extern NSString * const ASLayoutElementStyleLayoutPositionProperty; */ @property (nonatomic, assign, readwrite) ASLayoutSize maxLayoutSize; - -#pragma mark - ASStackLayoutElement - -/** - * @abstract Additional space to place before this object in the stacking direction. - * Used when attached to a stack layout. - */ -@property (nonatomic, assign) CGFloat spacingBefore; - -/** - * @abstract Additional space to place after this object in the stacking direction. - * Used when attached to a stack layout. - */ -@property (nonatomic, assign) CGFloat spacingAfter; - -/** - * @abstract If the sum of childrens' stack dimensions is less than the minimum size, how much should this component grow? - * This value represents the "flex grow factor" and determines how much this component should grow in relation to any - * other flexible children. - */ -@property (nonatomic, assign) CGFloat flexGrow; - -/** - * @abstract If the sum of childrens' stack dimensions is greater than the maximum size, how much should this component shrink? - * This value represents the "flex shrink factor" and determines how much this component should shink in relation to - * other flexible children. - */ -@property (nonatomic, assign) CGFloat flexShrink; - -/** - * @abstract Specifies the initial size in the stack dimension for this object. - * Default to ASDimensionAuto - * Used when attached to a stack layout. - */ -@property (nonatomic, assign) ASDimension flexBasis; - -/** - * @abstract Orientation of the object along cross axis, overriding alignItems - * Used when attached to a stack layout. - */ -@property (nonatomic, assign) ASStackLayoutAlignSelf alignSelf; - -/** - * @abstract Used for baseline alignment. The distance from the top of the object to its baseline. - */ -@property (nonatomic, assign) CGFloat ascender; - -/** - * @abstract Used for baseline alignment. The distance from the baseline of the object to its bottom. - */ -@property (nonatomic, assign) CGFloat descender; - - -#pragma mark - ASAbsoluteLayoutElement - -/** - * @abstract The position of this object within its parent spec. - */ -@property (nonatomic, assign) CGPoint layoutPosition; - @end diff --git a/AsyncDisplayKit/Layout/ASLayoutElement.mm b/AsyncDisplayKit/Layout/ASLayoutElement.mm index 8387c2ef2e..087ec1af57 100644 --- a/AsyncDisplayKit/Layout/ASLayoutElement.mm +++ b/AsyncDisplayKit/Layout/ASLayoutElement.mm @@ -115,6 +115,16 @@ do {\ @dynamic width, height, minWidth, maxWidth, minHeight, maxHeight; @dynamic preferredSize, minSize, maxSize, preferredLayoutSize, minLayoutSize, maxLayoutSize; +@synthesize spacingBefore = _spacingBefore; +@synthesize spacingAfter = _spacingAfter; +@synthesize flexGrow = _flexGrow; +@synthesize flexShrink = _flexShrink; +@synthesize flexBasis = _flexBasis; +@synthesize alignSelf = _alignSelf; +@synthesize ascender = _ascender; +@synthesize descender = _descender; +@synthesize layoutPosition = _layoutPosition; + #pragma mark - Lifecycle - (instancetype)initWithDelegate:(id)delegate @@ -296,6 +306,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingBeforeProperty); } +- (CGFloat)spacingBefore +{ + ASDN::MutexLocker l(__instanceLock__); + return _spacingBefore; +} + - (void)setSpacingAfter:(CGFloat)spacingAfter { ASDN::MutexLocker l(__instanceLock__); @@ -303,6 +319,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleSpacingAfterProperty); } +- (CGFloat)spacingAfter +{ + ASDN::MutexLocker l(__instanceLock__); + return _spacingAfter; +} + - (void)setFlexGrow:(CGFloat)flexGrow { ASDN::MutexLocker l(__instanceLock__); @@ -310,6 +332,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexGrowProperty); } +- (CGFloat)flexGrow +{ + ASDN::MutexLocker l(__instanceLock__); + return _flexGrow; +} + - (void)setFlexShrink:(CGFloat)flexShrink { ASDN::MutexLocker l(__instanceLock__); @@ -317,6 +345,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexShrinkProperty); } +- (CGFloat)flexShrink +{ + ASDN::MutexLocker l(__instanceLock__); + return _flexShrink; +} + - (void)setFlexBasis:(ASDimension)flexBasis { ASDN::MutexLocker l(__instanceLock__); @@ -324,6 +358,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleFlexBasisProperty); } +- (ASDimension)flexBasis +{ + ASDN::MutexLocker l(__instanceLock__); + return _flexBasis; +} + - (void)setAlignSelf:(ASStackLayoutAlignSelf)alignSelf { ASDN::MutexLocker l(__instanceLock__); @@ -331,6 +371,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAlignSelfProperty); } +- (ASStackLayoutAlignSelf)alignSelf +{ + ASDN::MutexLocker l(__instanceLock__); + return _alignSelf; +} + - (void)setAscender:(CGFloat)ascender { ASDN::MutexLocker l(__instanceLock__); @@ -338,6 +384,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleAscenderProperty); } +- (CGFloat)ascender +{ + ASDN::MutexLocker l(__instanceLock__); + return _ascender; +} + - (void)setDescender:(CGFloat)descender { ASDN::MutexLocker l(__instanceLock__); @@ -345,6 +397,12 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleDescenderProperty); } +- (CGFloat)descender +{ + ASDN::MutexLocker l(__instanceLock__); + return _descender; +} + #pragma mark - ASAbsoluteLayoutElement - (void)setLayoutPosition:(CGPoint)layoutPosition @@ -354,5 +412,11 @@ do {\ ASLayoutElementStyleCallDelegate(ASLayoutElementStyleLayoutPositionProperty); } +- (CGPoint)layoutPosition +{ + ASDN::MutexLocker l(__instanceLock__); + return _layoutPosition; +} + @end