Merge pull request #2240 from 821938089/little-fix

修复仿真翻页点击时翻页动画异常
pull/2247/head
kunfei 2 years ago committed by GitHub
commit 166ff99da8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/HorizontalPageDelegate.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt

@ -119,7 +119,7 @@ abstract class HorizontalPageDelegate(readView: ReadView) : PageDelegate(readVie
abortAnim() abortAnim()
if (!hasNext()) return if (!hasNext()) return
setDirection(PageDirection.NEXT) setDirection(PageDirection.NEXT)
readView.setStartPoint(viewWidth.toFloat(), 0f, false) readView.setStartPoint(viewWidth.toFloat(), 1f, false)
onAnimStart(animationSpeed) onAnimStart(animationSpeed)
} }
@ -127,7 +127,7 @@ abstract class HorizontalPageDelegate(readView: ReadView) : PageDelegate(readVie
abortAnim() abortAnim()
if (!hasPrev()) return if (!hasPrev()) return
setDirection(PageDirection.PREV) setDirection(PageDirection.PREV)
readView.setStartPoint(0f, 0f, false) readView.setStartPoint(0f, viewHeight.toFloat(), false)
onAnimStart(animationSpeed) onAnimStart(animationSpeed)
} }

@ -189,7 +189,7 @@ class SimulationPageDelegate(readView: ReadView) : HorizontalPageDelegate(readVi
dx = if (mCornerX > 0 && mDirection == PageDirection.NEXT) { dx = if (mCornerX > 0 && mDirection == PageDirection.NEXT) {
-(viewWidth + touchX) -(viewWidth + touchX)
} else { } else {
(viewWidth - touchX + viewWidth) viewWidth - touchX
} }
dy = if (mCornerY > 0) { dy = if (mCornerY > 0) {
(viewHeight - touchY) (viewHeight - touchY)

Loading…
Cancel
Save