From f5d1f9ca357e9171d5a9cc3c6b7c63198569a98a Mon Sep 17 00:00:00 2001 From: yeyinglong Date: Mon, 30 Jan 2023 14:53:41 +0800 Subject: [PATCH] modify onScrollBegin to onScrollFrameBegin Signed-off-by: yeyinglong --- .../entry/src/main/ets/MainAbility/pages/list.ets | 10 +++++----- .../entry/src/main/ets/MainAbility/pages/scroll.ets | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets index 32ac65e2f..93928f3de 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets @@ -98,13 +98,13 @@ struct ListLanes { .alignListItem(ListItemAlign.Start) .border({ width: 3, color: Color.Red }) .lanes({ minLength: 40, maxLength: 60 }) - .onScrollBegin((dx: number, dy: number) => { - if ((this.listPosition == 0 && dy >= 0) || (this.listPosition == 2 && dy <= 0)) { - this.scroller.scrollBy(0, -dy) - return { dxRemain: dx, dyRemain: 0 } + .onScrollFrameBegin((offset: number, state: ScrollState) => { + if ((this.listPosition == 0 && offset >= 0) || (this.listPosition == 2 && offset <= 0)) { + this.scroller.scrollBy(0, -offset) + return { offsetRemain: 0 } } this.listPosition = 1; - return { dxRemain: dx, dyRemain: dy } + return { offsetRemain: offset } try { var backData = { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets index 01f8c565b..bbecbe823 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/scroll.ets @@ -61,9 +61,9 @@ struct ScrollOnScrollBegin { }.width('100%') } .scrollable(ScrollDirection.Vertical) - .onScrollBegin((dx: number, dy: number) => { - console.info('dx=' + dx + ",dy=" + dy) - return { dxRemain: dx, dyRemain: dy } + .onScrollFrameBegin((offset: number, state: ScrollState) => { + console.info('offset=' + offset) + return { offsetRemain: offset } }) .scrollBar(BarState.On) .scrollBarColor(Color.Gray) -- GitLab