mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
回退 'Pull Request !49040 : List多列模式支持方向键Z字形走焦'
This commit is contained in:
parent
67fc6cf82b
commit
ec22a43c0c
@ -1094,8 +1094,27 @@ WeakPtr<FocusHub> ListPattern::GetNextFocusNode(FocusStep step, const WeakPtr<Fo
|
||||
moveStep = -curListItemGroupPara.lanes;
|
||||
nextIndexInGroup = curIndexInGroup + moveStep;
|
||||
}
|
||||
} else if ((step == FocusStep::TAB) ||
|
||||
(isVertical && (step == FocusStep::RIGHT)) || (!isVertical && step == FocusStep::DOWN)) {
|
||||
} else if ((isVertical && (step == FocusStep::RIGHT)) || (!isVertical && step == FocusStep::DOWN)) {
|
||||
moveStep = 1;
|
||||
if (((curIndexInGroup == -1) && ((curIndex - (lanes_ - 1)) % lanes_ != 0)) ||
|
||||
((curIndexInGroup != -1) &&
|
||||
((curIndexInGroup - (curListItemGroupPara.lanes - 1)) % curListItemGroupPara.lanes == 0))) {
|
||||
nextIndex = curIndex + moveStep;
|
||||
nextIndexInGroup = -1;
|
||||
} else if ((curIndexInGroup != -1) &&
|
||||
((curIndexInGroup - (curListItemGroupPara.lanes - 1)) % curListItemGroupPara.lanes != 0)) {
|
||||
nextIndexInGroup = curIndexInGroup + moveStep;
|
||||
}
|
||||
} else if ((isVertical && step == FocusStep::LEFT) || (!isVertical && step == FocusStep::UP)) {
|
||||
moveStep = -1;
|
||||
if (((curIndexInGroup == -1) && (curIndex % lanes_ != 0)) ||
|
||||
((curIndexInGroup != -1) && (curIndexInGroup % curListItemGroupPara.lanes == 0))) {
|
||||
nextIndex = curIndex + moveStep;
|
||||
nextIndexInGroup = -1;
|
||||
} else if ((curIndexInGroup != -1) && (curIndexInGroup % curListItemGroupPara.lanes != 0)) {
|
||||
nextIndexInGroup = curIndexInGroup + moveStep;
|
||||
}
|
||||
} else if (step == FocusStep::TAB) {
|
||||
moveStep = 1;
|
||||
if ((curIndexInGroup == -1) || (curIndexInGroup >= curListItemGroupPara.itemEndIndex)) {
|
||||
nextIndex = curIndex + moveStep;
|
||||
@ -1103,8 +1122,7 @@ WeakPtr<FocusHub> ListPattern::GetNextFocusNode(FocusStep step, const WeakPtr<Fo
|
||||
} else {
|
||||
nextIndexInGroup = curIndexInGroup + moveStep;
|
||||
}
|
||||
} else if ((step == FocusStep::SHIFT_TAB) ||
|
||||
(isVertical && step == FocusStep::LEFT) || (!isVertical && step == FocusStep::UP)) {
|
||||
} else if (step == FocusStep::SHIFT_TAB) {
|
||||
moveStep = -1;
|
||||
if ((curIndexInGroup == -1) || (curIndexInGroup <= 0)) {
|
||||
nextIndex = curIndex + moveStep;
|
||||
|
@ -326,7 +326,7 @@ HWTEST_F(ListCommonTestNg, FocusStep003, TestSize.Level1)
|
||||
*/
|
||||
int32_t currentIndex = 2;
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::NONE, currentIndex, NULL_VALUE));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::LEFT, currentIndex, 1));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::LEFT, currentIndex, NULL_VALUE));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::UP, currentIndex, 0));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::RIGHT, currentIndex, 3));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::DOWN, currentIndex, 4));
|
||||
@ -344,7 +344,7 @@ HWTEST_F(ListCommonTestNg, FocusStep003, TestSize.Level1)
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::NONE, currentIndex, NULL_VALUE));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::LEFT, currentIndex, 2));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::UP, currentIndex, 1));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::RIGHT, currentIndex, 4));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::RIGHT, currentIndex, NULL_VALUE));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::DOWN, currentIndex, 5));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::LEFT_END, currentIndex, 0));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::UP_END, currentIndex, 0));
|
||||
@ -375,7 +375,7 @@ HWTEST_F(ListCommonTestNg, FocusStep004, TestSize.Level1)
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::LEFT, currentIndex, 1));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::UP, currentIndex, 2));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::RIGHT, currentIndex, 5));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::DOWN, currentIndex, 4));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::DOWN, currentIndex, NULL_VALUE));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::LEFT_END, currentIndex, 0));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::UP_END, currentIndex, 0));
|
||||
EXPECT_TRUE(IsEqualNextFocusNode(FocusStep::RIGHT_END, currentIndex, 5));
|
||||
|
Loading…
Reference in New Issue
Block a user