iOS: fix case when parent is fit,child is most, align to android
This commit is contained in:
parent
f43406dc4a
commit
d8412f3a96
@ -17,6 +17,50 @@ class LayoutTest extends Panel {
|
||||
textAlignment: gravity().center(),
|
||||
height: 50,
|
||||
}),
|
||||
stack(
|
||||
[
|
||||
stack(
|
||||
[
|
||||
|
||||
text({
|
||||
text: "This is a stack content xxxxx",
|
||||
textSize: 20,
|
||||
textColor: Color.WHITE,
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: layoutConfig().most(),
|
||||
backgroundColor: Color.BLUE
|
||||
}
|
||||
),
|
||||
stack(
|
||||
[
|
||||
|
||||
text({
|
||||
text: "This is a stack content 000000000",
|
||||
textSize: 20,
|
||||
textColor: Color.WHITE,
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: layoutConfig().most(),
|
||||
backgroundColor: Color.YELLOW,
|
||||
alpha: 0.1
|
||||
}
|
||||
),
|
||||
text({
|
||||
text: "This is a stack content",
|
||||
textSize: 20,
|
||||
textColor: Color.WHITE,
|
||||
}),
|
||||
],
|
||||
{
|
||||
layoutConfig: {
|
||||
widthSpec: LayoutSpec.FIT,
|
||||
heightSpec: LayoutSpec.FIT,
|
||||
},
|
||||
backgroundColor: Color.RED
|
||||
}),
|
||||
stack(
|
||||
[
|
||||
stack(
|
||||
@ -49,7 +93,7 @@ class LayoutTest extends Panel {
|
||||
}
|
||||
),
|
||||
text({
|
||||
text: "This is a stack content",
|
||||
text: "This is a vlayout content",
|
||||
textSize: 20,
|
||||
textColor: Color.WHITE,
|
||||
}),
|
||||
|
@ -120,7 +120,9 @@ - (void)measureSelf:(CGSize)targetSize {
|
||||
CGFloat width;
|
||||
CGFloat height;
|
||||
if (self.widthSpec == DoricLayoutMost) {
|
||||
if (self.view.superview.doricLayout.layoutType == DoricHLayout && self.weight > 0) {
|
||||
if (self.view.superview.doricLayout.widthSpec == DoricLayoutFit) {
|
||||
width = targetSize.width;
|
||||
} else if (self.view.superview.doricLayout.layoutType == DoricHLayout && self.weight > 0) {
|
||||
width = self.measuredWidth = 0;
|
||||
} else {
|
||||
width = self.measuredWidth = targetSize.width;
|
||||
@ -193,11 +195,13 @@ - (void)measureContent:(CGSize)targetSize {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (self.view.superview.doricLayout.layoutType != DoricUndefined && self.view.superview.doricLayout.widthSpec == DoricLayoutFit && self.widthSpec == DoricLayoutMost) {
|
||||
self.measuredWidth = targetSize.width;
|
||||
|
||||
if (self.view.superview.doricLayout.widthSpec == DoricLayoutFit && self.widthSpec == DoricLayoutMost) {
|
||||
self.measuredWidth = self.contentWidth + self.paddingLeft + self.paddingRight;
|
||||
}
|
||||
if (self.view.superview.doricLayout.layoutType != DoricUndefined && self.view.superview.doricLayout.heightSpec == DoricLayoutFit && self.heightSpec == DoricLayoutMost) {
|
||||
self.measuredHeight = targetSize.height;
|
||||
|
||||
if (self.view.superview.doricLayout.heightSpec == DoricLayoutFit && self.heightSpec == DoricLayoutMost) {
|
||||
self.measuredHeight = self.contentHeight + self.paddingTop + self.paddingBottom;
|
||||
}
|
||||
}
|
||||
|
||||
@ -494,9 +498,6 @@ - (void)layoutVLayout {
|
||||
if (self.widthSpec == DoricLayoutFit && layout.widthSpec == DoricLayoutMost) {
|
||||
layout.measuredWidth = self.measuredWidth - layout.marginLeft - layout.marginRight;
|
||||
}
|
||||
if (self.heightSpec == DoricLayoutFit && layout.heightSpec == DoricLayoutMost) {
|
||||
layout.measuredHeight = self.measuredHeight - yStart - layout.marginTop - layout.marginBottom;
|
||||
}
|
||||
[layout layout];
|
||||
DoricGravity gravity = layout.alignment | self.gravity;
|
||||
if ((gravity & DoricGravityLeft) == DoricGravityLeft) {
|
||||
@ -537,10 +538,6 @@ - (void)layoutHLayout {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self.widthSpec == DoricLayoutFit && layout.widthSpec == DoricLayoutMost) {
|
||||
layout.measuredWidth = self.measuredWidth - xStart - layout.marginLeft - layout.marginRight;
|
||||
}
|
||||
|
||||
if (self.heightSpec == DoricLayoutFit && layout.heightSpec == DoricLayoutMost) {
|
||||
layout.measuredHeight = self.measuredHeight - layout.marginTop - layout.marginBottom;
|
||||
}
|
||||
|
Reference in New Issue
Block a user