iOS: fix when set padding

This commit is contained in:
pengfei.zhou 2021-05-07 19:04:46 +08:00 committed by osborn
parent a46bfe9284
commit 98db105a73

View File

@ -429,10 +429,10 @@ - (void)layoutStack {
continue; continue;
} }
if (self.widthSpec == DoricLayoutFit && layout.widthSpec == DoricLayoutMost) { if (self.widthSpec == DoricLayoutFit && layout.widthSpec == DoricLayoutMost) {
layout.measuredWidth = self.measuredWidth - layout.marginLeft - layout.marginRight; layout.measuredWidth = self.contentWidth - layout.marginLeft - layout.marginRight;
} }
if (self.heightSpec == DoricLayoutFit && layout.heightSpec == DoricLayoutMost) { if (self.heightSpec == DoricLayoutFit && layout.heightSpec == DoricLayoutMost) {
layout.measuredHeight = self.measuredHeight - layout.marginTop - layout.marginBottom; layout.measuredHeight = self.contentHeight - layout.marginTop - layout.marginBottom;
} }
[layout layout]; [layout layout];
DoricGravity gravity = layout.alignment; DoricGravity gravity = layout.alignment;
@ -488,7 +488,7 @@ - (void)layoutVLayout {
continue; continue;
} }
if (self.widthSpec == DoricLayoutFit && layout.widthSpec == DoricLayoutMost) { if (self.widthSpec == DoricLayoutFit && layout.widthSpec == DoricLayoutMost) {
layout.measuredWidth = self.measuredWidth - layout.marginLeft - layout.marginRight; layout.measuredWidth = self.contentWidth - layout.marginLeft - layout.marginRight;
} }
[layout layout]; [layout layout];
DoricGravity gravity = layout.alignment | self.gravity; DoricGravity gravity = layout.alignment | self.gravity;
@ -531,7 +531,7 @@ - (void)layoutHLayout {
} }
if (self.heightSpec == DoricLayoutFit && layout.heightSpec == DoricLayoutMost) { if (self.heightSpec == DoricLayoutFit && layout.heightSpec == DoricLayoutMost) {
layout.measuredHeight = self.measuredHeight - layout.marginTop - layout.marginBottom; layout.measuredHeight = self.contentHeight - layout.marginTop - layout.marginBottom;
} }
[layout layout]; [layout layout];