!46974 修复第一次点击输入框显示单手柄的问题

Merge pull request !46974 from LuckClover/FirstShowHandle
This commit is contained in:
openharmony_ci 2024-10-29 03:48:14 +00:00 committed by Gitee
commit e7538345d1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 0 deletions

View File

@ -1327,6 +1327,7 @@ void TextFieldPattern::HandleBlurEvent()
}
ReportEvent();
ScheduleDisappearDelayTask();
focusReason_ = RequestFocusReason::SYSTEM;
}
void TextFieldPattern::ModifyInnerStateInBlurEvent()
@ -2349,6 +2350,9 @@ void TextFieldPattern::HandleClickEvent(GestureEvent& info)
StopTwinkling();
return;
}
} else if (focusReason_ == RequestFocusReason::SYSTEM) {
firstGetFocus = true;
focusReason_ = RequestFocusReason::CLICK;
}
if (IsMouseOverScrollBar(info) && hasMousePressed_) {
Point point(info.GetLocalLocation().GetX(), info.GetLocalLocation().GetY());
@ -2721,6 +2725,9 @@ void TextFieldPattern::OnCursorTwinkling()
host->MarkDirtyNode(PROPERTY_UPDATE_RENDER);
}
ScheduleCursorTwinkling();
if (focusReason_ == RequestFocusReason::SYSTEM) {
focusReason_ = RequestFocusReason::UNKNOWN;
}
}
void TextFieldPattern::StopTwinkling()

View File

@ -158,6 +158,7 @@ enum class RequestFocusReason {
AUTO_FILL,
CLEAN_NODE,
MOUSE,
SYSTEM
};
@ -1988,6 +1989,7 @@ private:
WeakPtr<FrameNode> firstAutoFillContainerNode_;
float lastCaretPos_ = 0.0f;
std::optional<float> maxFontSizeScale_;
RequestFocusReason focusReason_ = RequestFocusReason::SYSTEM;
};
} // namespace OHOS::Ace::NG