mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
fix get page current offset
Signed-off-by: hw_ljz <lijiazhi2@huawei.com>
This commit is contained in:
parent
abb2a6f754
commit
b159f5c7cb
@ -111,8 +111,7 @@ bool LayoutWrapper::AvoidKeyboard(bool isFocusOnPage)
|
||||
auto renderContext = GetHostNode()->GetRenderContext();
|
||||
CHECK_NULL_RETURN(renderContext, false);
|
||||
auto safeArea = manager->GetSafeArea();
|
||||
auto safeAreaTop = manager->IsAtomicService() ? 0 : safeArea.top_.Length();
|
||||
auto pageCurrentOffset = renderContext->GetPaintRectWithoutTransform().GetY() - safeAreaTop;
|
||||
auto pageCurrentOffset = GetPageCurrentOffset();
|
||||
auto pageHasOffset = LessNotEqual(pageCurrentOffset, 0.0f);
|
||||
if (!(isFocusOnPage || isFocusOnOverlay || pageHasOffset) && LessNotEqual(manager->GetKeyboardOffset(), 0.0)) {
|
||||
renderContext->SavePaintRect(true, GetLayoutProperty()->GetPixelRound());
|
||||
@ -590,7 +589,7 @@ float LayoutWrapper::GetPageCurrentOffset()
|
||||
CHECK_NULL_RETURN(pipeline, 0.0f);
|
||||
auto stageManager = pipeline->GetStageManager();
|
||||
CHECK_NULL_RETURN(stageManager, 0.0f);
|
||||
auto pageNode = stageManager->GetLastPageWithTransition();
|
||||
auto pageNode = stageManager->GetPageById(host->GetPageId());
|
||||
CHECK_NULL_RETURN(pageNode, 0.0f);
|
||||
auto pageRenderContext = pageNode->GetRenderContext();
|
||||
CHECK_NULL_RETURN(pageRenderContext, 0.0f);
|
||||
|
@ -770,7 +770,7 @@ HWTEST_F(LayoutWrapperTestTwoNg, LayoutWrapperTest015, TestSize.Level1)
|
||||
|
||||
node->SetActive(true);
|
||||
EXPECT_TRUE(layoutWrapper->AvoidKeyboard());
|
||||
EXPECT_TRUE(layoutWrapper->AvoidKeyboard(false));
|
||||
EXPECT_FALSE(layoutWrapper->AvoidKeyboard(false));
|
||||
EXPECT_TRUE(node->GetFocusHub());
|
||||
EXPECT_TRUE(!node->GetFocusHub()->IsCurrentFocus());
|
||||
EXPECT_TRUE(LessNotEqual(safeAreamanager->GetKeyboardOffset(), 0.0));
|
||||
@ -969,7 +969,7 @@ HWTEST_F(LayoutWrapperTestTwoNg, LayoutWrapperTest021, TestSize.Level1)
|
||||
|
||||
node->SetActive(true);
|
||||
EXPECT_TRUE(layoutWrapper->AvoidKeyboard());
|
||||
EXPECT_TRUE(layoutWrapper->AvoidKeyboard(false));
|
||||
EXPECT_FALSE(layoutWrapper->AvoidKeyboard(false));
|
||||
EXPECT_TRUE(LessNotEqual(safeAreamanager->GetKeyboardOffset(), 0.0));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user