iOS: DoricLayout add other logic such as maxWidth and maxHeight and so on
This commit is contained in:
parent
8fbbaa7f56
commit
16cc6446e9
@ -180,6 +180,9 @@ - (DoricMeasureSpec)getRootMeasureSpec:(CGFloat)targetSize
|
||||
case DoricLayoutMost:
|
||||
return DoricMeasureSpecMake(DoricMeasureExactly, targetSize);
|
||||
case DoricLayoutFit:
|
||||
if ([self.view.superview isKindOfClass:UIScrollView.class]) {
|
||||
return DoricMeasureSpecMake(DoricMeasureAtMost, CGFLOAT_MAX);
|
||||
}
|
||||
return DoricMeasureSpecMake(DoricMeasureAtMost, targetSize);
|
||||
default:
|
||||
return DoricMeasureSpecMake(DoricMeasureExactly, size);
|
||||
@ -483,7 +486,12 @@ - (void)measureWidth:(DoricMeasureSpec)widthSpec height:(DoricMeasureSpec)height
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self.measuredWidth > self.maxWidth || self.measuredHeight > self.measuredHeight) {
|
||||
[self measureWidth:DoricMeasureSpecMake(DoricMeasureAtMost,
|
||||
MIN(self.measuredWidth, self.maxWidth))
|
||||
height:DoricMeasureSpecMake(DoricMeasureAtMost,
|
||||
MIN(self.measuredHeight, self.maxHeight))];
|
||||
}
|
||||
// self.measuredCache[measuredKey] = [NSString stringWithFormat:@"%@;%@",
|
||||
// @(self.measuredWidth),
|
||||
// @(self.measuredHeight)];
|
||||
@ -994,7 +1002,7 @@ - (void)stackMeasureWidth:(DoricMeasureSpec)widthMeasureSpec
|
||||
self.measuredState = (widthSizeAndState.state
|
||||
<< DORIC_MEASURED_HEIGHT_STATE_SHIFT) | heightSizeAndState.state;
|
||||
|
||||
if (matchParentChildren.count > 1) {
|
||||
if (matchParentChildren.count > 0) {
|
||||
for (DoricLayout *child in matchParentChildren) {
|
||||
DoricMeasureSpec childWidthMeasureSpec;
|
||||
if (child.widthSpec == DoricLayoutMost) {
|
||||
|
Reference in New Issue
Block a user