iOS: do not need layout when in measuring

This commit is contained in:
pengfei.zhou 2022-08-17 17:24:50 +08:00 committed by osborn
parent 99e0af494e
commit c02a54d417

View File

@ -298,7 +298,7 @@ - (void)measureContent:(CGSize)targetSize {
self.measuredHeight = self.contentHeight + self.paddingTop + self.paddingBottom; self.measuredHeight = self.contentHeight + self.paddingTop + self.paddingBottom;
} }
if (self.view.superview.doricLayout.layoutType == DoricHLayout if (self.inHLayout
&& self.view.superview.doricLayout.widthSpec == DoricLayoutFit && self.view.superview.doricLayout.widthSpec == DoricLayoutFit
&& self.weight > 0 && self.weight > 0
&& self.widthSpec == DoricLayoutJust && self.widthSpec == DoricLayoutJust
@ -461,7 +461,7 @@ - (void)measureStackContent:(CGSize)targetSize {
if (layout.disabled) { if (layout.disabled) {
continue; continue;
} }
[layout measure:[layout removeMargin:targetSize]]; [layout measureSelf:[layout removeMargin:targetSize]];
contentWidth = MAX(contentWidth, layout.takenWidth); contentWidth = MAX(contentWidth, layout.takenWidth);
contentHeight = MAX(contentHeight, layout.takenHeight); contentHeight = MAX(contentHeight, layout.takenHeight);
} }
@ -487,7 +487,7 @@ - (void)measureVLayoutContent:(CGSize)targetSize {
continue; continue;
} }
had = YES; had = YES;
[layout measure:[layout removeMargin:CGSizeMake( [layout measureSelf:[layout removeMargin:CGSizeMake(
targetSize.width, targetSize.width,
layout.weight > 0 ? targetSize.height : targetSize.height - contentHeight)]]; layout.weight > 0 ? targetSize.height : targetSize.height - contentHeight)]];
contentWidth = MAX(contentWidth, layout.takenWidth); contentWidth = MAX(contentWidth, layout.takenWidth);
@ -547,7 +547,7 @@ - (void)measureHLayoutContent:(CGSize)targetSize {
continue; continue;
} }
had = YES; had = YES;
[layout measure:[layout removeMargin:CGSizeMake( [layout measureSelf:[layout removeMargin:CGSizeMake(
layout.weight > 0 ? targetSize.width : targetSize.width - contentWidth, layout.weight > 0 ? targetSize.width : targetSize.width - contentWidth,
targetSize.height)]]; targetSize.height)]];
contentWidth += layout.takenWidth + self.spacing; contentWidth += layout.takenWidth + self.spacing;