提交 82901e98 编写于 作者: L lancer

Description: fix scrollTop & scrollBottom function

IssueNo: https://gitee.com/openharmony/ace_ace_engine/issues/I4PB5F
Feature or Bugfix: Bugfix
Binary Source:No
Signed-off-by: Nlancer <haoshuo@huawei.com>
上级 aa24e090
......@@ -354,17 +354,28 @@ bool UIList::MoveOffset(int16_t x, int16_t y)
scrollListener_->OnScrollStart(onSelectedIndex_, onSelectedView_);
}
if (direction_ == VERTICAL && !isLoopList_) {
if (childrenHead_ && (childrenHead_->GetViewIndex() == startIndex_) &&
(childrenHead_->GetRelativeRect().GetTop() == (GetStyle(STYLE_PADDING_TOP) + GetStyle(STYLE_BORDER_WIDTH)))) {
if (scrollListener_) {
if (!isLoopList_ && scrollListener_) {
if (direction_ == VERTICAL) {
if (childrenHead_ && (childrenHead_->GetViewIndex() == startIndex_) &&
childrenHead_->GetRelativeRect().GetTop() >= 0 &&
childrenHead_->GetRelativeRect().GetTop() - y < 0) {
scrollListener_->OnScrollTop(childrenHead_->GetViewIndex(), childrenHead_);
}
if (childrenTail_ && (childrenTail_->GetViewIndex() == recycle_.GetAdapterItemCount()-1) &&
(childrenTail_->GetRelativeRect().GetBottom() <= GetContentRect().GetHeight() - 1) &&
(childrenTail_->GetRelativeRect().GetBottom() - y > GetContentRect().GetHeight() - 1)) {
scrollListener_->OnScrollBottom(childrenTail_->GetViewIndex(), childrenTail_);
}
}
if (childrenTail_ && (recycle_.GetView(childrenTail_->GetViewIndex() + 1) == nullptr) &&
(childrenTail_->GetRelativeRect().GetBottom() + 1 ==
(GetRect().GetHeight() - GetStyle(STYLE_PADDING_BOTTOM) - GetStyle(STYLE_BORDER_WIDTH)))) {
if ((scrollListener_)) {
else {
if (childrenHead_ && (childrenHead_->GetViewIndex() == startIndex_) &&
childrenHead_->GetRelativeRect().GetLeft() >= 0 &&
childrenHead_->GetRelativeRect().GetLeft() - x < 0) {
scrollListener_->OnScrollTop(childrenHead_->GetViewIndex(), childrenHead_);
}
if (childrenTail_ && (childrenTail_->GetViewIndex() == recycle_.GetAdapterItemCount()-1) &&
(childrenTail_->GetRelativeRect().GetRight() <= GetContentRect().GetWidth() - 1) &&
(childrenTail_->GetRelativeRect().GetRight() - x > GetContentRect().GetWidth() - 1)) {
scrollListener_->OnScrollBottom(childrenTail_->GetViewIndex(), childrenTail_);
}
}
......
......@@ -100,8 +100,8 @@ public:
* be set to {@link NULL_SELECT_INDEX} if no child view is selected or no position is preset.
* @param view Indicates the child view being selected at the preset position. This parameter should be set to
* <b>NULL</b> if no child view is selected or no position is preset.
* @since 1.0
* @version 1.0
* @since 8
* @version 8
*
*/
virtual void OnScrollTop(int16_t index, UIView* view) {}
......@@ -113,8 +113,8 @@ public:
* be set to {@link NULL_SELECT_INDEX} if no child view is selected or no position is preset.
* @param view Indicates the child view being selected at the preset position. This parameter should be set to
* <b>NULL</b> if no child view is selected or no position is preset.
* @since 1.0
* @version 1.0
* @since 8
* @version 8
*
*/
virtual void OnScrollBottom(int16_t index, UIView* view) {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册