|
|
@ -21,20 +21,22 @@ class CoverPageDelegate(pageView: PageView) : PageDelegate(pageView) { |
|
|
|
override fun onScrollStart() { |
|
|
|
override fun onScrollStart() { |
|
|
|
val distanceX: Float |
|
|
|
val distanceX: Float |
|
|
|
when (direction) { |
|
|
|
when (direction) { |
|
|
|
Direction.NEXT -> if (isCancel) { |
|
|
|
Direction.NEXT -> distanceX = |
|
|
|
var dis = viewWidth - startX + touchX |
|
|
|
if (isCancel) { |
|
|
|
if (dis > viewWidth) { |
|
|
|
var dis = viewWidth - startX + touchX |
|
|
|
dis = viewWidth.toFloat() |
|
|
|
if (dis > viewWidth) { |
|
|
|
|
|
|
|
dis = viewWidth.toFloat() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
viewWidth - dis |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
-(touchX + (viewWidth - startX)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else -> distanceX = |
|
|
|
|
|
|
|
if (isCancel) { |
|
|
|
|
|
|
|
-(touchX - startX) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
viewWidth - (touchX - startX) |
|
|
|
} |
|
|
|
} |
|
|
|
distanceX = viewWidth - dis |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
distanceX = -(touchX + (viewWidth - startX)) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else -> distanceX = if (isCancel) { |
|
|
|
|
|
|
|
-(touchX - startX) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
viewWidth - (touchX - startX) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
startScroll(touchX.toInt(), 0, distanceX.toInt(), 0) |
|
|
|
startScroll(touchX.toInt(), 0, distanceX.toInt(), 0) |
|
|
|