Fix tap control area shifting in multi-window mode

This commit is contained in:
FooIbar authored and renovate[bot] committed 2024-05-07 15:37:38 +08:00
1 parent 51699cafe6
commit d9249eeedb
2 files changed
+12 -2

No files matched your search

@@ -96,7 +96,12 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
},
)
pager.tapListener = { event ->
val pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
val windowOffset = IntArray(2)
activity.window.decorView.getLocationOnScreen(windowOffset)
val pos = PointF(
(event.rawX - windowOffset[0]) / pager.width,
(event.rawY - windowOffset[1]) / pager.height,
)
val navigator = config.navigator
when (navigator.getAction(pos)) {
@@ -86,7 +86,12 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
},
)
recycler.tapListener = { event ->
val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height)
val windowOffset = IntArray(2)
activity.window.decorView.getLocationOnScreen(windowOffset)
val pos = PointF(
(event.rawX - windowOffset[0]) / recycler.width,
(event.rawY - windowOffset[1]) / recycler.height,
)
val navigator = config.navigator
when (navigator.getAction(pos)) {