From cc135d50b35ba3de523790eb02fed231f9f3ddec Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 19 Feb 2020 15:32:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../page/delegate/SimulationPageDelegate.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) 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 a0702a6c9..e48c53b7a 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 @@ -64,16 +64,18 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi private var nextBitmap: Bitmap? = null init { - mMaxLength = hypot(pageView.width.toDouble(), pageView.height.toDouble()).toFloat() + mMaxLength = hypot(viewWidth.toDouble(), viewWidth.toDouble()).toFloat() mPaint.style = Paint.Style.FILL //设置颜色数组 createDrawable() - val cm = ColorMatrix() - val array = floatArrayOf( - 1f, 0f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, - 0f, 0f, 1f, 0f, 0f, 0f, 0f, 0f, 1f, 0f + val cm = ColorMatrix( + floatArrayOf( + 1f, 0f, 0f, 0f, 0f, + 0f, 1f, 0f, 0f, 0f, + 0f, 0f, 1f, 0f, 0f, + 0f, 0f, 0f, 1f, 0f + ) ) - cm.set(array) mColorMatrixFilter = ColorMatrixColorFilter(cm) touchX = 0.01f //不让x,y为0,否则在点计算时会有问题 @@ -88,15 +90,13 @@ class SimulationPageDelegate(pageView: PageView) : HorizontalPageDelegate(pageVi override fun setTouchPoint(x: Float, y: Float, invalidate: Boolean) { super.setTouchPoint(x, y, invalidate) //触摸y中间位置吧y变成屏幕高度 - if ((startY > pageView.height / 3.0 - && startY < pageView.height * 2 / 3.0) + if ((startY > viewHeight * 0.33 && startY < viewHeight * 0.66) || mDirection == Direction.PREV ) { - touchY = pageView.height.toFloat() + touchY = viewHeight.toFloat() } - if (startY > pageView.height / 3.0 - && startY < pageView.height / 2.0 + if (startY > viewHeight * 0.33 && startY < viewHeight / 2.0 && mDirection == Direction.NEXT ) { touchY = 1f