private fun scrollParent(deltaX: Float): Offset {
val parentIsBetweenPages = parentState.isBetweenPages()
if (!parentIsBetweenPages && !parentState.canScrollInGestureDirection(deltaX)) {
parentDragActive = false
return Offset.Zero
}
// PagerState.dispatchRawDelta uses pager scroll coordinates. For LTR horizontal pagers,
// those coordinates are the opposite of the user's drag delta, so invert both input and
// return value.
val consumed = -parentState.dispatchRawDelta(-deltaX)
if (consumed.absoluteValue > 0f) {
parentDragActive = true
}
return Offset(x = consumed, y = 0f)
}
中使用-parentState.dispatchRawDelta(-deltaX),会在甩手幅度过大的时候,导致可能滑动很多页
想知道这个思路是为什么?是怕父控件还需要在网上分发吗?
中使用
-parentState.dispatchRawDelta(-deltaX),会在甩手幅度过大的时候,导致可能滑动很多页想知道这个思路是为什么?是怕父控件还需要在网上分发吗?