From dcedae90a3dd78bb9e54a90c4183544199c9ad09 Mon Sep 17 00:00:00 2001 From: lanyill Date: Wed, 22 Feb 2023 22:57:40 +0800 Subject: [PATCH] =?UTF-8?q?fixed=209450387=20from=20https://gitee.com/lany?= =?UTF-8?q?ill/ace=5Face=5Fengine/pulls/10233=20=E4=BF=AE=E5=A4=8DLine?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=8D=E8=AE=BE=E7=BD=AE=E5=AE=BD=E9=AB=98?= =?UTF-8?q?=E6=97=B6=E7=BB=98=E5=88=B6=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lanyill --- .../pattern/shape/line_layout_algorithm.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frameworks/core/components_ng/pattern/shape/line_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/shape/line_layout_algorithm.cpp index 8866aae54fc..fcae7ecd32d 100644 --- a/frameworks/core/components_ng/pattern/shape/line_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/shape/line_layout_algorithm.cpp @@ -31,17 +31,23 @@ std::optional LineLayoutAlgorithm::MeasureContent( CHECK_NULL_RETURN(host, std::nullopt); auto paintProperty = host->GetPaintProperty(); CHECK_NULL_RETURN(paintProperty, std::nullopt); - + auto strokewidth = paintProperty->GetStrokeWidth()->ConvertToPx(); PointF startPoint = PointF(paintProperty->GetStartPointValue().first.ConvertToPx(), paintProperty->GetStartPointValue().second.ConvertToPx()); PointF endPoint = PointF( paintProperty->GetEndPointValue().first.ConvertToPx(), paintProperty->GetEndPointValue().second.ConvertToPx()); - auto width = startPoint.GetX() > endPoint.GetX() ? (startPoint.GetX() - endPoint.GetX()) : (endPoint.GetX() - startPoint.GetX()); auto height = startPoint.GetY() > endPoint.GetY() ? (startPoint.GetY() - endPoint.GetY()) : (endPoint.GetY() - startPoint.GetY()); + if (strokewidth > width) { + width = strokewidth; + } + + if (strokewidth > height) { + height = strokewidth; + } return SizeF(width, height); } } // namespace OHOS::Ace::NG -- Gitee