!48033 添加获取键盘高度的接口

Merge pull request !48033 from Winstonffgg/master
This commit is contained in:
openharmony_ci 2024-11-09 02:34:02 +00:00 committed by Gitee
commit 93d4f7893b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 14 additions and 0 deletions

View File

@ -401,6 +401,9 @@ public:
auto pipeline = AceType::DynamicCast<NG::PipelineContext>(context);
if (pipeline) {
ContainerScope scope(instanceId_);
auto manager = pipeline->GetSafeAreaManager();
CHECK_NULL_VOID(manager);
manager->SetRawKeyboardHeight(keyboardRect.Height());
auto uiExtMgr = pipeline->GetUIExtensionManager();
if (uiExtMgr) {
SetUIExtensionImeShow(keyboardRect);

View File

@ -150,6 +150,16 @@ public:
return keyboardOffset_;
}
float GetRawKeyboardHeight() const
{
return rawKeyboardHeight_;
}
void SetRawKeyboardHeight(float height)
{
rawKeyboardHeight_ = height;
}
bool KeyboardSafeAreaEnabled() const
{
return keyboardSafeAreaEnabled_;
@ -321,6 +331,7 @@ private:
float keyboardOffset_ = 0.0f;
float lastKeyboardY_ = 0.0f;
float rawKeyboardHeight_ = 0.0f;
static constexpr float SAFE_AREA_VELOCITY = 0.0f;
static constexpr float SAFE_AREA_MASS = 1.0f;