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 8866aae54fc42b0025d90879e9f1b3f53066234f..fcae7ecd32dc98ea67863b5e01e91d4bc6ad88c8 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