diff --git a/frameworks/core/components_ng/pattern/text_drag/text_drag_pattern.cpp b/frameworks/core/components_ng/pattern/text_drag/text_drag_pattern.cpp index 9f79494b9bb3cc89d5ed548c86a75d89b0d7b9c8..f6b43add8a98268a97f86970a734c4f79dc66028 100644 --- a/frameworks/core/components_ng/pattern/text_drag/text_drag_pattern.cpp +++ b/frameworks/core/components_ng/pattern/text_drag/text_drag_pattern.cpp @@ -52,7 +52,12 @@ const RectF GetLastBoxRect(const std::vector& boxes, const RectF& content bool hasResult = false; RectF result; RectF preBox; - auto maxBottom = contentRect.GetY() + SystemProperties::GetDevicePhysicalHeight(); + auto deviceHeight = SystemProperties::GetDevicePhysicalHeight(); + auto container = Container::CurrentSafely(); + if (container && container->GetDisplayInfo()) { + deviceHeight = container->GetDisplayInfo()->GetHeight(); + } + auto maxBottom = contentRect.GetY() + deviceHeight; for (const auto& box : boxes) { auto caculateBottom = box.Bottom() + textStartY; bool isReachingBottom = (caculateBottom >= maxBottom) || (caculateBottom >= contentRect.Bottom());