diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt index e7b76fc6e..c710367c7 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/PageDelegate.kt @@ -136,7 +136,7 @@ abstract class PageDelegate(protected val pageView: PageView) : bitmap = null } - fun setViewSize(width: Int, height: Int) { + open fun setViewSize(width: Int, height: Int) { viewWidth = width viewHeight = height pageView.invalidate() diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt index 789fb61e1..cdffc0457 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/delegate/SimulationPageDelegate.kt @@ -115,6 +115,11 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi mFrontShadowDrawableHBT.gradientType = GradientDrawable.LINEAR_GRADIENT } + override fun setViewSize(width: Int, height: Int) { + super.setViewSize(width, height) + mMaxLength = hypot(viewWidth.toDouble(), viewWidth.toDouble()).toFloat() + } + override fun setStartPoint(x: Float, y: Float, invalidate: Boolean) { super.setStartPoint(x, y, invalidate) calcCornerXY(x, y) @@ -171,7 +176,6 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi override fun onAnimStart() { var dx: Float val dy: Float - // dx 水平方向滑动的距离,负值会使滚动向左滚动 // dy 垂直方向滑动的距离,负值会使滚动向上滚动 if (isCancel) { dx = if (mCornerX > 0 && mDirection == Direction.NEXT) {