Fix tap control area shifting after zooming out (#767)

This commit is contained in:
FooIbar 2024-05-07 17:13:43 +08:00 committed by GitHub
parent 1df87eabf2
commit 8e9396a9cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -28,7 +28,8 @@ class WebtoonRecyclerView @JvmOverloads constructor(
private var atFirstPosition = false private var atFirstPosition = false
private var halfWidth = 0 private var halfWidth = 0
private var halfHeight = 0 private var halfHeight = 0
private var originalHeight = 0 var originalHeight = 0
private set
private var heightSet = false private var heightSet = false
private var firstVisibleItemPosition = 0 private var firstVisibleItemPosition = 0
private var lastVisibleItemPosition = 0 private var lastVisibleItemPosition = 0

View File

@ -117,7 +117,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
recycler.getLocationInWindow(viewPositionRelativeToWindow) recycler.getLocationInWindow(viewPositionRelativeToWindow)
val pos = PointF( val pos = PointF(
(event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / recycler.width, (event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / recycler.width,
(event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / recycler.height, (event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / recycler.originalHeight,
) )
when (config.navigator.getAction(pos)) { when (config.navigator.getAction(pos)) {
NavigationRegion.MENU -> activity.toggleMenu() NavigationRegion.MENU -> activity.toggleMenu()