mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
[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.
This commit is contained in:
@@ -17,9 +17,11 @@ ASRelativeDimension const ASRelativeDimensionUnconstrained = {};
|
||||
|
||||
ASRelativeDimension ASRelativeDimensionMake(ASRelativeDimensionType type, CGFloat value)
|
||||
{
|
||||
if (type == ASRelativeDimensionTypePoints) { ASDisplayNodeCAssertPositiveReal(@"Points", value); }
|
||||
if (type == ASRelativeDimensionTypePercent) {
|
||||
ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", value);
|
||||
if (type == ASRelativeDimensionTypePoints) {
|
||||
ASDisplayNodeCAssertPositiveReal(@"Points", value);
|
||||
} else if (type == ASRelativeDimensionTypePercent) {
|
||||
// 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.
|
||||
// ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", value);
|
||||
}
|
||||
ASRelativeDimension dimension; dimension.type = type; dimension.value = value; return dimension;
|
||||
}
|
||||
@@ -32,7 +34,7 @@ ASRelativeDimension ASRelativeDimensionMakeWithPoints(CGFloat points)
|
||||
|
||||
ASRelativeDimension ASRelativeDimensionMakeWithPercent(CGFloat percent)
|
||||
{
|
||||
ASDisplayNodeCAssert( 0 <= percent && percent <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", percent);
|
||||
// ASDisplayNodeCAssert( 0 <= percent && percent <= 1.0, @"ASRelativeDimension percent value (%f) must be between 0 and 1.", percent);
|
||||
return ASRelativeDimensionMake(ASRelativeDimensionTypePercent, percent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user