mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-19 21:00:10 +00:00
More Percent -> Fraction
This commit is contained in:
parent
f07d5c4e99
commit
3f77a3d46c
@ -19,9 +19,9 @@ ASRelativeDimension ASRelativeDimensionMake(ASRelativeDimensionType type, CGFloa
|
|||||||
{
|
{
|
||||||
if (type == ASRelativeDimensionTypePoints) {
|
if (type == ASRelativeDimensionTypePoints) {
|
||||||
ASDisplayNodeCAssertPositiveReal(@"Points", value);
|
ASDisplayNodeCAssertPositiveReal(@"Points", value);
|
||||||
} else if (type == ASRelativeDimensionTypePercent) {
|
} else if (type == ASRelativeDimensionTypeFraction) {
|
||||||
// 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.
|
// 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);
|
// ASDisplayNodeCAssert( 0 <= value && value <= 1.0, @"ASRelativeDimension fraction value (%f) must be between 0 and 1.", value);
|
||||||
}
|
}
|
||||||
ASRelativeDimension dimension; dimension.type = type; dimension.value = value; return dimension;
|
ASRelativeDimension dimension; dimension.type = type; dimension.value = value; return dimension;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,11 +39,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
extern ASRelativeSize ASRelativeSizeMake(ASRelativeDimension width, ASRelativeDimension height);
|
extern ASRelativeSize ASRelativeSizeMake(ASRelativeDimension width, ASRelativeDimension height);
|
||||||
|
|
||||||
/** Convenience constructor to provide size in Points. */
|
/** Convenience constructor to provide size in points. */
|
||||||
extern ASRelativeSize ASRelativeSizeMakeWithCGSize(CGSize size);
|
extern ASRelativeSize ASRelativeSizeMakeWithCGSize(CGSize size);
|
||||||
|
|
||||||
/** Convenience constructor to provide size in Percentage. */
|
/** Convenience constructor to provide size as a fraction. */
|
||||||
extern ASRelativeSize ASRelativeSizeMakeWithPercent(CGFloat percent);
|
extern ASRelativeSize ASRelativeSizeMakeWithFraction(CGFloat fraction);
|
||||||
|
|
||||||
/** Resolve this relative size relative to a parent size. */
|
/** Resolve this relative size relative to a parent size. */
|
||||||
extern CGSize ASRelativeSizeResolveSize(ASRelativeSize relativeSize, CGSize parentSize);
|
extern CGSize ASRelativeSizeResolveSize(ASRelativeSize relativeSize, CGSize parentSize);
|
||||||
@ -61,7 +61,7 @@ extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelati
|
|||||||
|
|
||||||
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactCGSize(CGSize exact);
|
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactCGSize(CGSize exact);
|
||||||
|
|
||||||
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactPercent(CGFloat percent);
|
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactFraction(CGFloat fraction);
|
||||||
|
|
||||||
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeDimensions(ASRelativeDimension exactWidth,
|
extern ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeDimensions(ASRelativeDimension exactWidth,
|
||||||
ASRelativeDimension exactHeight);
|
ASRelativeDimension exactHeight);
|
||||||
|
|||||||
@ -25,10 +25,10 @@ ASRelativeSize ASRelativeSizeMakeWithCGSize(CGSize size)
|
|||||||
ASRelativeDimensionMakeWithPoints(size.height));
|
ASRelativeDimensionMakeWithPoints(size.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASRelativeSize ASRelativeSizeMakeWithPercent(CGFloat percent)
|
ASRelativeSize ASRelativeSizeMakeWithFraction(CGFloat fraction)
|
||||||
{
|
{
|
||||||
return ASRelativeSizeMake(ASRelativeDimensionMakeWithPercent(percent),
|
return ASRelativeSizeMake(ASRelativeDimensionMakeWithFraction(fraction),
|
||||||
ASRelativeDimensionMakeWithPercent(percent));
|
ASRelativeDimensionMakeWithFraction(fraction));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGSize ASRelativeSizeResolveSize(ASRelativeSize relativeSize, CGSize parentSize)
|
CGSize ASRelativeSizeResolveSize(ASRelativeSize relativeSize, CGSize parentSize)
|
||||||
@ -67,9 +67,9 @@ ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactCGSize(CGSize exact)
|
|||||||
return ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelativeSizeMakeWithCGSize(exact));
|
return ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelativeSizeMakeWithCGSize(exact));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactPercent(CGFloat percent)
|
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactFraction(CGFloat fraction)
|
||||||
{
|
{
|
||||||
return ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelativeSizeMakeWithPercent(percent));
|
return ASRelativeSizeRangeMakeWithExactRelativeSize(ASRelativeSizeMakeWithFraction(fraction));
|
||||||
}
|
}
|
||||||
|
|
||||||
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeDimensions(ASRelativeDimension exactWidth,
|
ASRelativeSizeRange ASRelativeSizeRangeMakeWithExactRelativeDimensions(ASRelativeDimension exactWidth,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user