This repository was archived by the owner on Feb 2, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,12 +31,12 @@ typedef enum : NSUInteger {
3131 */
3232@property (nonatomic , assign ) BOOL laysOutHorizontally;
3333
34- /* * Horizontally align content(text or image).
34+ /* * Horizontally align content (text or image).
3535 Defaults to ASAlignmentMiddle.
3636 */
3737@property (nonatomic , assign ) ASHorizontalAlignment contentHorizontalAlignment;
3838
39- /* * Vertically align content(text or image).
39+ /* * Vertically align content (text or image).
4040 Defaults to ASAlignmentCenter.
4141 */
4242@property (nonatomic , assign ) ASVerticalAlignment contentVerticalAlignment;
Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ - (instancetype)init
3939 _titleNode = [[ASTextNode alloc ] init ];
4040 _imageNode = [[ASImageNode alloc ] init ];
4141
42+ _contentHorizontalAlignment = ASAlignmentMiddle;
43+ _contentVerticalAlignment = ASAlignmentCenter;
44+
4245 [self addSubnode: _titleNode];
4346 [self addSubnode: _imageNode];
4447
@@ -195,8 +198,8 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
195198 ASStackLayoutSpec *stack = [[ASStackLayoutSpec alloc ] init ];
196199 stack.direction = self.laysOutHorizontally ? ASStackLayoutDirectionHorizontal : ASStackLayoutDirectionVertical;
197200 stack.spacing = self.contentSpacing ;
198- stack.horizontalAlignment = self. contentHorizontalAlignment ? self. contentHorizontalAlignment : ASAlignmentMiddle ;
199- stack.verticalAlignment = self. contentVerticalAlignment ? self. contentVerticalAlignment : ASAlignmentCenter ;
201+ stack.horizontalAlignment = _contentHorizontalAlignment ;
202+ stack.verticalAlignment = _contentVerticalAlignment ;
200203
201204 NSMutableArray *children = [[NSMutableArray alloc ] initWithCapacity: 2 ];
202205 if (self.imageNode .image ) {
You can’t perform that action at this time.
0 commit comments