change to set measured y

This commit is contained in:
王劲鹏 2021-04-16 19:09:25 +08:00 committed by osborn
parent fb68b66128
commit 7b6a4c4d51

View File

@ -528,19 +528,20 @@ void DoricLayouts::layoutStack() {
if ((gravity & DoricGravity::DoricGravityTop) == if ((gravity & DoricGravity::DoricGravityTop) ==
DoricGravity::DoricGravityTop) { DoricGravity::DoricGravityTop) {
layout->measuredY = this->paddingTop; layout->setMeasuredY(this->paddingTop);
} else if ((gravity & DoricGravity::DoricGravityBottom) == } else if ((gravity & DoricGravity::DoricGravityBottom) ==
DoricGravity::DoricGravityBottom) { DoricGravity::DoricGravityBottom) {
layout->measuredY = layout->setMeasuredY(this->measuredHeight - this->paddingBottom -
this->measuredHeight - this->paddingBottom - layout->measuredHeight; layout->measuredHeight);
} else if ((gravity & DoricGravity::DoricGravityCenterY) == } else if ((gravity & DoricGravity::DoricGravityCenterY) ==
DoricGravity::DoricGravityCenterY) { DoricGravity::DoricGravityCenterY) {
layout->measuredY = this->measuredHeight / 2 - layout->measuredHeight / 2; layout->setMeasuredY(this->measuredHeight / 2 -
layout->measuredHeight / 2);
} else { } else {
if (layout->marginTop || layout->marginBottom) { if (layout->marginTop || layout->marginBottom) {
layout->measuredY = this->paddingTop; layout->setMeasuredY(this->paddingTop);
} else { } else {
layout->measuredY = 0; layout->setMeasuredY(0);
} }
} }
@ -628,7 +629,7 @@ void DoricLayouts::layoutVLayout() {
DoricGravity::DoricGravityLeft)) { DoricGravity::DoricGravityLeft)) {
layout->measuredX -= layout->marginRight; layout->measuredX -= layout->marginRight;
} }
layout->measuredY = yStart + layout->marginTop; layout->setMeasuredY(yStart + layout->marginTop);
yStart += this->spacing + layout->takenHeight(); yStart += this->spacing + layout->takenHeight();
} }
} }
@ -676,16 +677,17 @@ void DoricLayouts::layoutHLayout() {
int gravity = layout->alignment | this->gravity; int gravity = layout->alignment | this->gravity;
if ((gravity & DoricGravity::DoricGravityTop) == if ((gravity & DoricGravity::DoricGravityTop) ==
DoricGravity::DoricGravityTop) { DoricGravity::DoricGravityTop) {
layout->measuredY = this->paddingTop; layout->setMeasuredY(this->paddingTop);
} else if ((gravity & DoricGravity::DoricGravityBottom) == } else if ((gravity & DoricGravity::DoricGravityBottom) ==
DoricGravity::DoricGravityBottom) { DoricGravity::DoricGravityBottom) {
layout->measuredY = layout->setMeasuredY(this->measuredHeight - this->paddingBottom -
this->measuredHeight - this->paddingBottom - layout->measuredHeight; layout->measuredHeight);
} else if ((gravity & DoricGravity::DoricGravityCenterY) == } else if ((gravity & DoricGravity::DoricGravityCenterY) ==
DoricGravity::DoricGravityCenterY) { DoricGravity::DoricGravityCenterY) {
layout->measuredY = this->measuredHeight / 2 - layout->measuredHeight / 2; layout->setMeasuredY(this->measuredHeight / 2 -
layout->measuredHeight / 2);
} else { } else {
layout->measuredY = this->paddingTop; layout->setMeasuredY(this->paddingTop);
} }
if (!gravity) { if (!gravity) {
gravity = DoricGravity::DoricGravityTop; gravity = DoricGravity::DoricGravityTop;