修复RTL模式下小眼睛与cancelButton的获焦框偏移的问题

Signed-off-by: wanjining <wanjining@huawei.com>
Change-Id: I2c0926db96964687e62980f3d32b1e1c6ecc5759
This commit is contained in:
wanjining 2024-11-20 16:47:36 +08:00
parent ef994acc28
commit 2e7fcf9678

View File

@ -7936,7 +7936,16 @@ void TextFieldPattern::GetIconPaintRect(const RefPtr<TextInputResponseArea>& res
auto imageFrameNode = AceType::DynamicCast<FrameNode>(imageNode);
CHECK_NULL_VOID(imageFrameNode);
auto imageRect = imageFrameNode->GetGeometryNode()->GetFrameRect();
RectF rect(stackRect.GetX(), stackRect.GetY(), imageRect.Width(), imageRect.Height());
auto layoutProperty = GetLayoutProperty<TextFieldLayoutProperty>();
CHECK_NULL_VOID(layoutProperty);
auto isRTL = layoutProperty->GetNonAutoLayoutDirection() == TextDirection::RTL;
RectF rect;
if (isRTL) {
rect = RectF(stackRect.GetX() + stackRect.Width() - imageRect.Width(),
stackRect.GetY(), imageRect.Width(), imageRect.Height());
} else {
rect = RectF(stackRect.GetX(), stackRect.GetY(), imageRect.Width(), imageRect.Height());
}
paintRect.SetRect(rect);
}