[Layout] Add support for flex factor (#2298)

* Add support for flex factor

* Add snapshot tests

* Respect child specified size from ASLayoutable

* Add new snapshot test images

* Fix rebase conflict
This commit is contained in:
Michael Schneider
2016-09-27 15:39:50 -07:00
committed by Adlai Holler
parent f421787cd3
commit e85583523f
44 changed files with 440 additions and 147 deletions

View File

@@ -269,16 +269,18 @@ extern NSString * const ASLayoutableStyleLayoutPositionProperty;
@property (nonatomic, assign) CGFloat spacingAfter;
/**
* @abstract If the sum of childrens' stack dimensions is less than the minimum size, should this object grow?
* Used when attached to a stack layout.
* @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) BOOL flexGrow;
@property (nonatomic, assign) CGFloat flexGrow;
/**
* @abstract If the sum of childrens' stack dimensions is greater than the maximum size, should this object shrink?
* Used when attached to a stack layout.
* @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) BOOL flexShrink;
@property (nonatomic, assign) CGFloat flexShrink;
/**
* @abstract Specifies the initial size in the stack dimension for this object.

View File

@@ -251,14 +251,14 @@ do {\
ASLayoutableStyleCallDelegate(ASLayoutableStyleSpacingAfterProperty);
}
- (void)setFlexGrow:(BOOL)flexGrow
- (void)setFlexGrow:(CGFloat)flexGrow
{
ASDN::MutexLocker l(__instanceLock__);
_flexGrow = flexGrow;
ASLayoutableStyleCallDelegate(ASLayoutableStyleFlexGrowProperty);
}
- (void)setFlexShrink:(BOOL)flexShrink
- (void)setFlexShrink:(CGFloat)flexShrink
{
ASDN::MutexLocker l(__instanceLock__);
_flexShrink = flexShrink;

View File

@@ -31,16 +31,18 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readwrite) CGFloat spacingAfter;
/**
* @abstract If the sum of childrens' stack dimensions is less than the minimum size, should this object grow?
* Used when attached to a stack layout.
* @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, readwrite) BOOL flexGrow;
@property (nonatomic, readwrite) CGFloat flexGrow;
/**
* @abstract If the sum of childrens' stack dimensions is greater than the maximum size, should this object shrink?
* Used when attached to a stack layout.
* @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, readwrite) BOOL flexShrink;
@property (nonatomic, readwrite) CGFloat flexShrink;
/**
* @abstract Specifies the initial size in the stack dimension for this object.