diff --git a/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.cpp index 0374a99b8eec3550cc59c10e24f13469d092ebf7..ca650d68520f3ee65303b904e8b87f6205741657 100644 --- a/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.cpp @@ -1143,8 +1143,6 @@ OffsetF BubbleLayoutAlgorithm::GetChildPositionNew( currentPlacementStates.end(), FOLLOW_CURSOR_TIPS.begin(), FOLLOW_CURSOR_TIPS.end()); } size_t step = ALIGNMENT_STEP_OFFSET; - bVertical_ = false; - bHorizontal_ = false; for (size_t i = 0, len = currentPlacementStates.size(); i < len;) { placement_ = currentPlacementStates[i]; if (placement_ == Placement::NONE) { @@ -1156,18 +1154,6 @@ OffsetF BubbleLayoutAlgorithm::GetChildPositionNew( continue; } } - if (bVertical_) { - if (setHorizontal_.find(placement_) != setHorizontal_.end()) { - i++; - continue; - } - } - if (bHorizontal_) { - if (setVertical_.find(placement_) != setVertical_.end()) { - i++; - continue; - } - } if (i >= step) { positionOffset_ = OffsetF(0.0f, 0.0f); } @@ -1182,8 +1168,6 @@ OffsetF BubbleLayoutAlgorithm::GetChildPositionNew( break; } if (placement_ == Placement::NONE) { - bVertical_ = false; - bHorizontal_ = false; position = GetAdjustPosition(currentPlacementStates, step, childSize, topPosition, bottomPosition, ArrowOffset); if (NearEqual(position, OffsetF(0.0f, 0.0f))) { position = AvoidOrCoverParent(childSize, bubbleProp, child, originPlacement, ArrowOffset); @@ -1406,18 +1390,6 @@ OffsetF BubbleLayoutAlgorithm::GetAdjustPosition(std::vector& current continue; } } - if (bVertical_) { - if (setHorizontal_.find(placement_) != setHorizontal_.end()) { - i++; - continue; - } - } - if (bHorizontal_) { - if (setVertical_.find(placement_) != setVertical_.end()) { - i++; - continue; - } - } childPosition = GetPositionWithPlacementNew(childSize, topPosition, bottomPosition, arrowPosition); UpdateChildPosition(childPosition); width = childSize.Width(); @@ -2392,8 +2364,6 @@ bool BubbleLayoutAlgorithm::CheckPositionBottom( if (GreatNotEqual(childSize.Height(), rect.Height())) { i += step; return false; - } else { - bVertical_ = true; } return true; } @@ -2416,8 +2386,6 @@ bool BubbleLayoutAlgorithm::CheckPositionTop( if (GreatNotEqual(childSize.Height(), rect.Height())) { i += step; return false; - } else { - bVertical_ = true; } return true; } @@ -2440,8 +2408,6 @@ bool BubbleLayoutAlgorithm::CheckPositionRight( if (GreatNotEqual(childSize.Width(), rect.Width())) { i += step; return false; - } else { - bHorizontal_ = true; } return true; } @@ -2464,8 +2430,6 @@ bool BubbleLayoutAlgorithm::CheckPositionLeft( if (GreatNotEqual(childSize.Width(), rect.Width())) { i += step; return false; - } else { - bHorizontal_ = true; } return true; } diff --git a/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.h b/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.h index 4c136e5267f7ee310753a067629b943007d361e3..5ccbd9e4eb49663ab4c60ca62b65c7a7da8585ec 100644 --- a/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.h +++ b/frameworks/core/components_ng/pattern/bubble/bubble_layout_algorithm.h @@ -364,8 +364,6 @@ private: float top_ = 0.0f; float bottom_ = 0.0f; bool avoidKeyboard_ = false; - bool bHorizontal_ = false; - bool bVertical_ = false; std::unordered_set setHorizontal_; std::unordered_set setVertical_; bool hasPlacement_ = false; diff --git a/test/unittest/core/pattern/bubble/bubble_test_One_ng.cpp b/test/unittest/core/pattern/bubble/bubble_test_One_ng.cpp index 018e583a907f6a592fe084964c74e98ce169e911..4e343480e3b2ff6d665bfee4ce4a72995cfa9346 100644 --- a/test/unittest/core/pattern/bubble/bubble_test_One_ng.cpp +++ b/test/unittest/core/pattern/bubble/bubble_test_One_ng.cpp @@ -910,15 +910,12 @@ HWTEST_F(BubbleTestOneNg, GetAdjustPosition001, TestSize.Level1) targetOffset.GetY() - childSize.Height()); auto offsetPos = OffsetF(0.0f, 0.0f); layoutAlgorithm->showArrow_ = true; - layoutAlgorithm->bVertical_ = true; layoutAlgorithm->bCaretMode_ = false; layoutAlgorithm->placement_ = Placement::LEFT; auto pos = layoutAlgorithm->GetAdjustPosition( curPlaceStates, 1, childSize, topPosition, bottomPosition, offsetPos); EXPECT_EQ(pos.GetX(), 0.0f); - layoutAlgorithm->bVertical_ = false; layoutAlgorithm->bCaretMode_ = false; - layoutAlgorithm->bHorizontal_ = true; layoutAlgorithm->placement_ = Placement::TOP; pos = layoutAlgorithm->GetAdjustPosition( curPlaceStates, 1, childSize, topPosition, bottomPosition, offsetPos); @@ -1304,7 +1301,7 @@ HWTEST_F(BubbleTestOneNg, BubbleAlgorithmTest001, TestSize.Level1) SizeF childSize(CHILD_SIZE_X, CHILD_SIZE_Y); auto targetSize = layoutAlgorithm->targetSize_ = SizeF(TARGET_SIZE_WIDTH, TARGET_SIZE_HEIGHT); auto targetOffset = layoutAlgorithm->targetOffset_ = OffsetF(POSITION_OFFSET, POSITION_OFFSET); - layoutAlgorithm->bCaretMode_ = layoutAlgorithm->bVertical_ = layoutAlgorithm->bHorizontal_ = true; + layoutAlgorithm->bCaretMode_ = true; OffsetF bottomPosition = OffsetF(targetOffset.GetX() + (targetSize.Width() - childSize.Width()) / 2.0, targetOffset.GetY() + targetSize.Height()); OffsetF topPosition = OffsetF(targetOffset.GetX() + (targetSize.Width() - childSize.Width()) / 2.0, diff --git a/test/unittest/core/pattern/bubble/bubble_test_ng.cpp b/test/unittest/core/pattern/bubble/bubble_test_ng.cpp index ed7e35594b272b76343218fabcd695f40484fc9a..59e6713098b7f8046c3db5c5b07625418cd15504 100644 --- a/test/unittest/core/pattern/bubble/bubble_test_ng.cpp +++ b/test/unittest/core/pattern/bubble/bubble_test_ng.cpp @@ -1665,7 +1665,6 @@ HWTEST_F(BubbleTestNg, BubbleLayoutTest004, TestSize.Level1) bubbleLayoutAlgorithm->UpdateTouchRegion(); } bubbleLayoutAlgorithm->bCaretMode_ = true; - bubbleLayoutAlgorithm->bHorizontal_ = true; SizeF childSizeFull(FULL_SCREEN_WIDTH, FULL_SCREEN_HEIGHT); bubbleLayoutAlgorithm->GetChildPositionNew(childSizeFull, bubbleLayoutProperty, childWrapper); }