Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 589efef

Browse files
committed
[ASDimension] Disable assertions for Percent values being between 0.0 and 1.0.
This triggers on existing code that needs to be updated, but also there is some investigation needed as to whether it is a valid use case to have a >1.0 value in order to position greater-than-bounds elements.
1 parent 26e23d5 commit 589efef

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

AsyncDisplayKit/Layout/ASDimension.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717

1818
ASRelativeDimension ASRelativeDimensionMake(ASRelativeDimensionType type, CGFloat value)
1919
{
20-
if (type == ASRelativeDimensionTypePoints) { ASDisplayNodeCAssertPositiveReal(@"Points", value); }
21-
if (type == ASRelativeDimensionTypePercent) {
22-
ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", value);
20+
if (type == ASRelativeDimensionTypePoints) {
21+
ASDisplayNodeCAssertPositiveReal(@"Points", value);
22+
} else if (type == ASRelativeDimensionTypePercent) {
23+
// TODO: Enable this assertion for 2.0. Check that there is no use case for using a larger value, e.g. to layout for a clipsToBounds = NO element.
24+
// ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", value);
2325
}
2426
ASRelativeDimension dimension; dimension.type = type; dimension.value = value; return dimension;
2527
}
@@ -32,7 +34,7 @@ ASRelativeDimension ASRelativeDimensionMakeWithPoints(CGFloat points)
3234

3335
ASRelativeDimension ASRelativeDimensionMakeWithPercent(CGFloat percent)
3436
{
35-
ASDisplayNodeCAssert( 0 <= percent && percent <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", percent);
37+
// ASDisplayNodeCAssert( 0 <= percent && percent <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", percent);
3638
return ASRelativeDimensionMake(ASRelativeDimensionTypePercent, percent);
3739
}
3840

0 commit comments

Comments
 (0)