mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-27 17:21:11 +00:00
fix text out of button problem
Signed-off-by: baoyang <baoyang9@huawei.com> Change-Id: Ia39a64edebdb8cb92ce740524f2d56a222859acb
This commit is contained in:
parent
50d85a2c58
commit
96da6fc2f5
@ -414,19 +414,39 @@ RefPtr<FrameNode> SecurityComponentLayoutAlgorithm::GetSecCompChildNode(RefPtr<F
|
||||
void SecurityComponentLayoutAlgorithm::UpdateTextRectPoint()
|
||||
{
|
||||
if (isVertical_) {
|
||||
double contextWidth = std::max(text_.width_, icon_.width_);
|
||||
textLeftTopPoint_ = SizeF(left_.width_, top_.height_ + icon_.height_ + middle_.height_);
|
||||
textRightTopPoint_ = SizeF(left_.width_ + contextWidth, top_.height_ + icon_.height_ + middle_.height_);
|
||||
textLeftBottomPoint_ = SizeF(left_.width_, top_.height_ + icon_.height_ + middle_.height_ + text_.height_);
|
||||
textRightBottomPoint_ = SizeF(left_.width_ + contextWidth, top_.height_ + icon_.height_ + middle_.height_ +
|
||||
text_.height_);
|
||||
if (icon_.width_ > text_.width_) {
|
||||
textLeftTopPoint_ = SizeF(left_.width_ + icon_.width_ / HALF - text_.width_ / HALF,
|
||||
top_.height_ + icon_.height_ + middle_.height_);
|
||||
textRightTopPoint_ = SizeF(left_.width_ + icon_.width_ / HALF + text_.width_ / HALF,
|
||||
top_.height_ + icon_.height_ + middle_.height_);
|
||||
textLeftBottomPoint_ = SizeF(left_.width_ + icon_.width_ / HALF - text_.width_ / HALF,
|
||||
top_.height_ + icon_.height_ + middle_.height_ + text_.height_);
|
||||
textRightBottomPoint_ = SizeF(left_.width_ + icon_.width_ / HALF + text_.width_ / HALF,
|
||||
top_.height_ + icon_.height_ + middle_.height_ + text_.height_);
|
||||
} else {
|
||||
textLeftTopPoint_ = SizeF(left_.width_, top_.height_ + icon_.height_ + middle_.height_);
|
||||
textRightTopPoint_ = SizeF(left_.width_ + text_.width_, top_.height_ + icon_.height_ + middle_.height_);
|
||||
textLeftBottomPoint_ = SizeF(left_.width_, top_.height_ + icon_.height_ + middle_.height_ + text_.height_);
|
||||
textRightBottomPoint_ = SizeF(left_.width_ + text_.width_,
|
||||
top_.height_ + icon_.height_ + middle_.height_ + text_.height_);
|
||||
}
|
||||
} else {
|
||||
double contextHeight = std::max(text_.height_, icon_.height_);
|
||||
textLeftTopPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_, top_.height_);
|
||||
textRightTopPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_ + text_.width_, top_.height_);
|
||||
textLeftBottomPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_, top_.height_ + contextHeight);
|
||||
textRightBottomPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_ + text_.width_, top_.height_ +
|
||||
contextHeight);
|
||||
if (icon_.height_ > text_.height_) {
|
||||
textLeftTopPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_,
|
||||
top_.height_ + icon_.height_ / HALF - text_.height_ / HALF);
|
||||
textRightTopPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_ + text_.width_,
|
||||
top_.height_ + icon_.height_ / HALF + text_.height_ / HALF);
|
||||
textLeftBottomPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_,
|
||||
top_.height_ + icon_.height_ / HALF - text_.height_ / HALF);
|
||||
textRightBottomPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_ + text_.width_,
|
||||
top_.height_ + icon_.height_ / HALF + text_.height_ / HALF);
|
||||
} else {
|
||||
textLeftTopPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_, top_.height_);
|
||||
textRightTopPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_ + text_.width_, top_.height_);
|
||||
textLeftBottomPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_, top_.height_ + text_.height_);
|
||||
textRightBottomPoint_ = SizeF(left_.width_ + icon_.width_ + middle_.width_ + text_.width_,
|
||||
top_.height_ + text_.height_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user