Bugfix: scrollable judgement error

Signed-off-by: bixuefeng <bixuefeng@huawei.com>
Change-Id: Ia3e1fa592420015a957903f9d6c020d286096bba
This commit is contained in:
bixuefeng
2022-03-23 16:03:07 +08:00
parent 03a3fb2775
commit 2af734d34c
3 changed files with 6 additions and 54 deletions
@@ -1074,24 +1074,8 @@ void RenderScroll::UpdateTouchRect()
bool RenderScroll::IsAxisScrollable(AxisDirection direction)
{
if (axis_ == Axis::VERTICAL) {
if (direction == AxisDirection::UP && IsAtTop()) {
return false;
} else if (direction == AxisDirection::DOWN && IsAtBottom()) {
return false;
} else if (direction == AxisDirection::NONE) {
return false;
}
} else {
if (direction == AxisDirection::LEFT && IsAtTop()) {
return false;
} else if (direction == AxisDirection::RIGHT && IsAtBottom()) {
return false;
} else if (direction == AxisDirection::NONE) {
return false;
}
}
return true;
return (((direction == AxisDirection::UP || direction == AxisDirection::LEFT) && !IsAtTop()) ||
((direction == AxisDirection::DOWN || direction == AxisDirection::RIGHT) && !IsAtBottom()));
}
void RenderScroll::HandleAxisEvent(const AxisEvent& event)
@@ -1452,24 +1452,8 @@ void RenderGridScroll::OnPredictLayout(int64_t deadline)
bool RenderGridScroll::IsAxisScrollable(AxisDirection direction)
{
if (isVertical_) {
if (direction == AxisDirection::UP && reachHead_) {
return false;
} else if (direction == AxisDirection::DOWN && reachTail_) {
return false;
} else if (direction == AxisDirection::NONE) {
return false;
}
} else {
if (direction == AxisDirection::LEFT && reachHead_) {
return false;
} else if (direction == AxisDirection::RIGHT && reachTail_) {
return false;
} else if (direction == AxisDirection::NONE) {
return false;
}
}
return true;
return (((direction == AxisDirection::UP || direction == AxisDirection::LEFT) && !reachHead_) ||
((direction == AxisDirection::DOWN || direction == AxisDirection::RIGHT) && !reachTail_));
}
void RenderGridScroll::HandleAxisEvent(const AxisEvent& event)
@@ -1675,24 +1675,8 @@ size_t RenderList::CalculateInsertIndex(
bool RenderList::IsAxisScrollable(AxisDirection direction)
{
if (vertical_) {
if (direction == AxisDirection::UP && reachStart_) {
return false;
} else if (direction == AxisDirection::DOWN && reachEnd_) {
return false;
} else if (direction == AxisDirection::NONE) {
return false;
}
} else {
if (direction == AxisDirection::LEFT && reachStart_) {
return false;
} else if (direction == AxisDirection::RIGHT && reachEnd_) {
return false;
} else if (direction == AxisDirection::NONE) {
return false;
}
}
return true;
return (((direction == AxisDirection::UP || direction == AxisDirection::LEFT) && !reachStart_) ||
((direction == AxisDirection::DOWN || direction == AxisDirection::RIGHT) && !reachEnd_));
}
void RenderList::HandleAxisEvent(const AxisEvent& event)